RefFn

Struct RefFn 

Source
pub struct RefFn<A, B, C>
where B: ?Sized, C: Fn(&A) -> &B,
{ /* private fields */ }

Implementations§

Source§

impl<A, B, C> RefFn<A, B, C>
where B: ?Sized, C: Fn(&A) -> &B,

Source

pub fn new(value: A, callback: C) -> Self

Source

pub fn call_ref(&self) -> &B

Trait Implementations§

Source§

impl<A, C> AsStr for RefFn<A, str, C>
where C: Fn(&A) -> &str,

Source§

fn as_str(&self) -> &str

👎Deprecated since 0.5.18: Use with_str instead
Source§

fn with_str<B, F>(&self, f: F) -> B
where F: FnOnce(&str) -> B,

Source§

impl<'a, A, C> MultiStr for RefFn<A, [&'a str], C>
where C: Fn(&A) -> &[&'a str],

Source§

fn find_map<B, F>(&self, f: F) -> Option<B>
where F: FnMut(&str) -> Option<B>,

Source§

fn each<F>(&self, f: F)
where F: FnMut(&str),

Auto Trait Implementations§

§

impl<A, B, C> Freeze for RefFn<A, B, C>
where A: Freeze, C: Freeze, B: ?Sized,

§

impl<A, B, C> RefUnwindSafe for RefFn<A, B, C>
where A: RefUnwindSafe, C: RefUnwindSafe, B: ?Sized,

§

impl<A, B, C> Send for RefFn<A, B, C>
where A: Send, C: Send, B: ?Sized,

§

impl<A, B, C> Sync for RefFn<A, B, C>
where A: Sync, C: Sync, B: ?Sized,

§

impl<A, B, C> Unpin for RefFn<A, B, C>
where A: Unpin, C: Unpin, B: ?Sized,

§

impl<A, B, C> UnwindSafe for RefFn<A, B, C>
where A: UnwindSafe, C: UnwindSafe, B: ?Sized,

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<A> MultiStr for A
where A: AsStr,

Source§

fn find_map<B, F>(&self, f: F) -> Option<B>
where F: FnMut(&str) -> Option<B>,

Source§

fn each<F>(&self, f: F)
where F: FnMut(&str),

Source§

impl<A> OptionStr for A
where A: MultiStr,

Source§

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

Source§

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>,

Source§

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.