SlugRef

Struct 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_f: &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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

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

Source§

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

Source§

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§

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: (unsized)