GetInto

Struct GetInto 

Source
pub struct GetInto<Inner, I>(/* private fields */);
Expand description

Converts Get<I> to Get<R> using Into.

Acts as a type-safe bridge between Get implementations where I: Into<R>.

  • Inner: The Get<I> implementation
  • I: Source type to convert from

§Example

use bounded_collections::Get;
use bounded_collections::GetInto;

struct MyGetter;
impl Get<u16> for MyGetter { fn get() -> u16 { 42 } }
let foo: u32 = GetInto::<MyGetter, u16>::get();
assert_eq!(foo, 42u32); // <--- infered as u32

Trait Implementations§

Source§

impl<Inner, I, R> Get<R> for GetInto<Inner, I>
where Inner: Get<I>, I: Into<R>,

Source§

fn get() -> R

Returns the converted value by:

  1. Getting the inner value of type I
  2. Converting it to type R using Into

Auto Trait Implementations§

§

impl<Inner, I> Freeze for GetInto<Inner, I>

§

impl<Inner, I> RefUnwindSafe for GetInto<Inner, I>
where Inner: RefUnwindSafe, I: RefUnwindSafe,

§

impl<Inner, I> Send for GetInto<Inner, I>
where Inner: Send, I: Send,

§

impl<Inner, I> Sync for GetInto<Inner, I>
where Inner: Sync, I: Sync,

§

impl<Inner, I> Unpin for GetInto<Inner, I>
where Inner: Unpin, I: Unpin,

§

impl<Inner, I> UnwindSafe for GetInto<Inner, I>
where Inner: UnwindSafe, I: UnwindSafe,

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

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.
Source§

impl<T> JsonSchemaMaybe for T