Struct tor_persist::slug::SlugRef

source ·
pub struct SlugRef(/* private fields */);
Expand description

A borrwed slug, checked for syntax

The syntax check can be relied on for safety/soundness.

Implementations§

source§

impl SlugRef

source

pub fn new(s: &str) -> Result<&SlugRef, BadSlug>

Make a SlugRef out of a str, if it has the correct syntax

source

pub unsafe fn new_unchecked<'s>(s: &'s str) -> &'s SlugRef

Make a SlugRef out of a str, without checking the syntax

§Safety

It’s the caller’s responsibility to check the syntax of the input string.

source§

impl SlugRef

source

pub fn as_str(&self) -> &str

Obtain this slug as a str

source§

impl SlugRef

source

pub fn as_path(&self) -> &Path

Obtain this slug as a Path

Trait Implementations§

source§

impl<'i> AsRef<&'i SlugRef> for InstancePurgeInfo<'i>

Available on crate feature state-dir only.
source§

fn as_ref(&self) -> &&'i SlugRef

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[u8]> for SlugRef

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<OsStr> for SlugRef

source§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Path> for SlugRef

source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for SlugRef

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<SlugRef> for Slug

source§

fn borrow(&self) -> &SlugRef

Immutably borrows from an owned value. Read more
source§

impl Debug for SlugRef

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for SlugRef

source§

fn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for SlugRef

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl Ord for SlugRef

source§

fn cmp(&self, other: &SlugRef) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl PartialEq for SlugRef

source§

fn eq(&self, other: &SlugRef) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for SlugRef

source§

fn partial_cmp(&self, other: &SlugRef) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for SlugRef

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToOwned for SlugRef

§

type Owned = Slug

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Slug

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'s> TryFrom<&'s str> for &'s SlugRef

§

type Error = BadSlug

The type returned in the event of a conversion error.
source§

fn try_from(s: &'s str) -> Result<&'s SlugRef, BadSlug>

Performs the conversion.
source§

impl Eq for SlugRef

source§

impl StructuralPartialEq for SlugRef

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> TryIntoSlug for T
where T: ToString + ?Sized,

source§

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

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