pub(crate) trait KeySpecifierComponent {
// Required methods
fn to_slug(&self) -> Result<Slug, Bug>;
fn from_slug(s: &Slug) -> Result<Self, InvalidKeyPathComponentValue>
where Self: Sized;
fn fmt_pretty(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}Expand description
A trait for serializing and deserializing specific types of Slugs.
A KeySpecifierComponent is a specific kind of Slug. A KeySpecifierComponent is
always a valid Slug, but may have a more restricted charset, or more specific
validation rules. A Slug is not always a valid KeySpecifierComponent
instance.
If you are deriving DefaultKeySpecifier for a
struct, all of its fields must implement this trait.
If you are implementing KeySpecifier and KeyPathInfoExtractor manually rather than by
deriving DefaultKeySpecifier, you do not need to implement this trait.