Trait Identifier

Source
pub trait Identifier: Eq {
    type Id;
    type ParseError;

    // Required methods
    fn generate() -> Self::Id;
    fn format(&self) -> String;
    fn parse_str(s: &str) -> Result<Self::Id, Self::ParseError>;
}
Expand description

Trait for id structures.

This trait is not intented to be implemented manually you should use derive. Refers to the module documentation to provide a module with functions to:

  • generate inner id / u128 value
  • validate

Required Associated Types§

Required Methods§

Source

fn generate() -> Self::Id

Generate a new id

Source

fn format(&self) -> String

format the id to a string

Source

fn parse_str(s: &str) -> Result<Self::Id, Self::ParseError>

Parse a string to an id

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§