tor_persist::slug

Trait TryIntoSlug

Source
pub trait TryIntoSlug {
    // Required method
    fn try_into_slug(&self) -> Result<Slug, BadSlug>;
}
Expand description

Types which can perhaps be used as a slug

This is a trait implemented by str, std::fmt::Arguments, and other implementors of ToString, for the convenience of call sites: APIs can have functions taking an &(impl TryIntoSlug + ?Sized) or &dyn TryIntoSlug and callers then don’t need error-handling boilerplate.

Functions that take a TryIntoSlug will need to do a runtime syntax check.

Required Methods§

Source

fn try_into_slug(&self) -> Result<Slug, BadSlug>

Convert self into a Slug, if it has the right syntax

Implementors§