summaryrefslogtreecommitdiffstats
path: root/vendor/unicode-security/src/general_security_profile.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/unicode-security/src/general_security_profile.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/unicode-security/src/general_security_profile.rs')
-rw-r--r--vendor/unicode-security/src/general_security_profile.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/unicode-security/src/general_security_profile.rs b/vendor/unicode-security/src/general_security_profile.rs
new file mode 100644
index 000000000..7daedddab
--- /dev/null
+++ b/vendor/unicode-security/src/general_security_profile.rs
@@ -0,0 +1,26 @@
+//! Utilities for working with the [General Security Profile](https://www.unicode.org/reports/tr39/#General_Security_Profile)
+//! for identifiers
+
+use crate::tables::identifier;
+
+pub use identifier::IdentifierType;
+
+/// Methods for determining characters not restricted from use for identifiers.
+pub trait GeneralSecurityProfile {
+ /// Returns whether the character is not restricted from use for identifiers.
+ fn identifier_allowed(self) -> bool;
+
+ /// Returns the [identifier type](https://www.unicode.org/reports/tr39/#Identifier_Status_and_Type)
+ fn identifier_type(self) -> Option<IdentifierType>;
+}
+
+impl GeneralSecurityProfile for char {
+ #[inline]
+ fn identifier_allowed(self) -> bool {
+ identifier::identifier_status_allowed(self)
+ }
+ #[inline]
+ fn identifier_type(self) -> Option<IdentifierType> {
+ identifier::identifier_type(self)
+ }
+}