Struct routefinder::Capture

source ·
pub struct Capture<'key, 'value> { /* private fields */ }
Expand description

An individual key-value pair

Implementations§

source§

impl<'key, 'value> Capture<'key, 'value>

source

pub fn new( key: impl Into<Cow<'key, str>>, value: impl Into<Cow<'value, str>> ) -> Self

Build a new Capture from the provided key and value. Passing a &str here is preferable, but a String will also work.

source

pub fn name(&self) -> &str

returns the name of this capture

source

pub fn value(&self) -> &str

returns the value of this capture

source

pub fn into_owned(self) -> Capture<'static, 'static>

transforms this potentially-borrowed Capture into a ’static capture that can outlive the source data. This allocates new strings if needed, and should be avoided unless necessary for a particular application

Trait Implementations§

source§

impl<'key, 'value> Debug for Capture<'key, 'value>

source§

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

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

impl<'key, 'value> Default for Capture<'key, 'value>

source§

fn default() -> Capture<'key, 'value>

Returns the “default value” for a type. Read more
source§

impl<'pair, 'key: 'pair, 'value: 'pair> From<&'pair (&'key str, &'value str)> for Capture<'key, 'value>

source§

fn from(kv: &'pair (&'key str, &'value str)) -> Self

Converts to this type from the input type.
source§

impl<'key, 'value> From<(&'key str, &'value str)> for Capture<'key, 'value>

source§

fn from(kv: (&'key str, &'value str)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'key, 'value> Freeze for Capture<'key, 'value>

§

impl<'key, 'value> RefUnwindSafe for Capture<'key, 'value>

§

impl<'key, 'value> Send for Capture<'key, 'value>

§

impl<'key, 'value> Sync for Capture<'key, 'value>

§

impl<'key, 'value> Unpin for Capture<'key, 'value>

§

impl<'key, 'value> UnwindSafe for Capture<'key, 'value>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.