pub trait Validator {
type Err: Error;
// Required method
fn validate_symbol(_: &str) -> Result<(), Self::Err>;
// Provided method
fn display(value: &Symbol<Self>, fmt: &mut Formatter<'_>) -> Result { ... }
}
Expand description
This is validator trait you should implement for your own symbols
In reality this trait serves three purposes:
- Validates that atom contains only value you expect it to contain
- Identifies the type i.e.
type S1 = Symbol<V1>
andtype S2 = Symbol<V2>
are different and incompatible types - Allows to override
Display
trait for your own symbol
Required Associated Types§
Required Methods§
Provided Methods§
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.