pub enum PiiClass {
Email,
Name,
Location,
Organization,
Custom(String),
}Expand description
The category of a detected PII span.
Built-in variants: Email, Name, Location, Organization. Tenant-specific PII
(case references, titles, internal codes) is carried as PiiClass::Custom(String).
There is no Phone variant – phone detection is provided by recognizers in
gaze-recognizers and surfaces as either a Custom("phone") class or a class
defined by a rulepack.
PiiClass is exhaustive. Match every variant explicitly so new built-in classes
force call sites to review their handling at compile time:
use gaze_types::PiiClass;
fn label(class: &PiiClass) -> &'static str {
match class {
PiiClass::Email => "email",
PiiClass::Name => "name",
PiiClass::Location => "location",
PiiClass::Organization => "org",
PiiClass::Custom(_) => "pii",
}
}Policy TOML uses the lowercase forms email / name / location / organization,
and tenant classes are spelled like custom:case_ref (lowercase, snake_case).
Variants§
Email address class.
Name
Person name class.
Location
Location class.
Organization
Organization class.
Custom(String)
Tenant- or policy-defined class.
Implementations§
Source§impl PiiClass
impl PiiClass
Sourcepub fn from_policy_name(input: &str) -> Option<Self>
pub fn from_policy_name(input: &str) -> Option<Self>
Parses a policy class name into the shared class vocabulary.
Sourcepub fn builtin_variants() -> &'static [PiiClass]
pub fn builtin_variants() -> &'static [PiiClass]
Returns the built-in class variants.
Sourcepub fn as_custom_name(&self) -> Option<&str>
pub fn as_custom_name(&self) -> Option<&str>
Returns the normalized custom class name for custom classes.
Sourcepub fn class_name(&self) -> String
pub fn class_name(&self) -> String
Returns the audit/token display label for this class.
Sourcepub fn to_canonical_str(&self) -> String
pub fn to_canonical_str(&self) -> String
Returns the canonical audit/serde label for this class.
Sourcepub fn from_canonical_str(value: &str) -> Option<Self>
pub fn from_canonical_str(value: &str) -> Option<Self>
Parses the canonical audit/serde label for a PII class.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PiiClass
impl<'de> Deserialize<'de> for PiiClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for PiiClass
impl Ord for PiiClass
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for PiiClass
impl PartialOrd for PiiClass
impl Eq for PiiClass
impl StructuralPartialEq for PiiClass
Auto Trait Implementations§
impl Freeze for PiiClass
impl RefUnwindSafe for PiiClass
impl Send for PiiClass
impl Sync for PiiClass
impl Unpin for PiiClass
impl UnsafeUnpin for PiiClass
impl UnwindSafe for PiiClass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more