Skip to content

Commit 6dc688d

Browse files
committed
Expose Identifier Type in API
1 parent 14ed9b1 commit 6dc688d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/general_security_profile.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
44
use crate::tables::identifier;
55

6+
pub use identifier::IdentifierType;
7+
68
/// Methods for determining characters not restricted from use for identifiers.
79
pub trait GeneralSecurityProfile {
810
/// Returns whether the character is not restricted from use for identifiers.
911
fn identifier_allowed(self) -> bool;
12+
13+
/// Returns the [identifier type](https://www.unicode.org/reports/tr39/#Identifier_Status_and_Type)
14+
fn identifier_type(self) -> Option<IdentifierType>;
1015
}
1116

1217
impl GeneralSecurityProfile for char {
1318
#[inline]
1419
fn identifier_allowed(self) -> bool { identifier::identifier_status_allowed(self) }
15-
}
16-
17-
impl GeneralSecurityProfile for &'_ str {
1820
#[inline]
19-
fn identifier_allowed(self) -> bool { self.chars().all(identifier::identifier_status_allowed) }
21+
fn identifier_type(self) -> Option<IdentifierType> { identifier::identifier_type(self) }
22+
2023
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy