Struct contextual::Contextual

source ·
pub struct Contextual<T, C>(pub T, pub C);

Tuple Fields§

§0: T§1: C

Implementations§

source§

impl<'a, T: AsRefWithContext<str, C> + ?Sized, C: ?Sized> Contextual<&'a T, &'a C>

source

pub fn as_str(&self) -> &'a str

source§

impl<'a, T: AsRefWithContext<str, C> + ?Sized, C: ?Sized> Contextual<&'a T, &'a mut C>

source

pub fn as_str(&self) -> &str

source§

impl<'a, T: IntoRefWithContext<'a, str, C>, C: ?Sized> Contextual<T, &'a C>

source

pub fn into_str(self) -> &'a str

source§

impl<'a, T: IntoRefWithContext<'a, str, C>, C: ?Sized> Contextual<T, &'a mut C>

source

pub fn into_str(self) -> &'a str

Trait Implementations§

source§

impl<'t, 'c, T: AsRefWithContext<U, C> + ?Sized, U: ?Sized, C> AsRef<U> for Contextual<&'t T, &'c C>

source§

fn as_ref(&self) -> &U

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

impl<'t, 'c, T: AsRefWithContext<U, C> + ?Sized, U: ?Sized, C> AsRef<U> for Contextual<&'t T, &'c mut C>

source§

fn as_ref(&self) -> &U

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

impl<T, C> Deref for Contextual<T, C>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T, C> DerefMut for Contextual<T, C>

source§

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

Mutably dereferences the value.
source§

impl<T: DisplayWithContext<C::Target>, C: Deref> Display for Contextual<T, C>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, C> RefUnwindSafe for Contextual<T, C>where C: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, C> Send for Contextual<T, C>where C: Send, T: Send,

§

impl<T, C> Sync for Contextual<T, C>where C: Sync, T: Sync,

§

impl<T, C> Unpin for Contextual<T, C>where C: Unpin, T: Unpin,

§

impl<T, C> UnwindSafe for Contextual<T, C>where C: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithContext for Twhere T: ?Sized,

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>