Trait VerifiedName

Source
pub(crate) trait VerifiedName: VerifiedSeal + Deref {
    // Provided methods
    fn validate_start(c: char) -> Result<(), Error> { ... }
    fn validate(s: &str) -> Result<Self, Error> { ... }
    fn is_valid_start(c: char) -> bool { ... }
    fn is_valid_char(c: char) -> bool { ... }
    fn extra_validation(_s: &str) -> Result<(), Error> { ... }
}
Expand description

A trait representing the unambiguous rules to validate and construct an identifier. The default implementations are the rules used for atom labels described in the top-level module documentation, but can be modified to allow for some flexibility, e.g. tags have identical rules with the exception of allowing : as an additional allowed separator.

Provided Methods§

Source

fn validate_start(c: char) -> Result<(), Error>

Validates that a character is a valid starting character.

Source

fn validate(s: &str) -> Result<Self, Error>

Constructor validating the entire string.

Source

fn is_valid_start(c: char) -> bool

Checks if a character is an invalid starting character.

Source

fn is_valid_char(c: char) -> bool

Checks if a character is valid for use.

Source

fn extra_validation(_s: &str) -> Result<(), Error>

Adds additional validation logic without overriding the default if required, does nothing by default.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl VerifiedName for Identifier

Unicode UAX #31 compliant identifier

Source§

impl VerifiedName for Label

Source§

impl VerifiedName for Tag