Trait tor_persist::slug::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§