[][src]Struct lifted::K2

pub struct K2<Me: ?Sized, T, U> { /* fields omitted */ }

An instance of a type produced by a binary type constructor.

You can freely convert between the wrapper and implementation types with new and the inner_* methods:

use lifted::types::ResultC;

let great: Result<i32, String> = Ok(42);
let mut wrapped: K2<ResultC, i32, String> = K2::new(great);

assert!(wrapped.inner().is_ok());

*wrapped.inner_mut() = Err("does not compute".into());

assert!(wrapped.into_inner().is_err());

Implementations

impl<Me: ?Sized + Kind2<T, U>, T, U> K2<Me, T, U>[src]

pub fn new(t: <Me as Kind2<T, U>>::Inner) -> Self[src]

Wrap an instance in the higher-kinded wrapper.

use lifted::types::OptionC;
let wrapped: K1<OptionC, i32> = K1::new(None);

There is also an alias in the Kind1 trait which you can use to produce a wrapped type.

let wrapped: K1<OptionC, i32> = OptionC::new(Some(42));

pub fn inner(&self) -> &<Me as Kind2<T, U>>::Inner[src]

Get a shared reference to the implementation type.

use lifted::types::OptionC;

let nothing: K1<OptionC, i32> = OptionC::new(None);
assert!(nothing.inner().is_none());

pub fn inner_mut(&mut self) -> &mut <Me as Kind2<T, U>>::Inner[src]

Get an exclusive reference to the implementation type.

use lifted::types::OptionC;

let mut nothing: K1<OptionC, i32> = OptionC::new(None);
*nothing.inner_mut() = Some(42);
assert!(nothing.inner().is_some());

pub fn into_inner(self) -> <Me as Kind2<T, U>>::Inner[src]

Extract the implementation type from the wrapper.

use lifted::types::OptionC;

let wrapped: K1<OptionC, i32> = OptionC::new(Some(42));
let unwrapped = wrapped.into_inner();
assert_eq!(Some(42), unwrapped);

impl<C: Kind2<A, B>, A, B> K2<C, A, B>[src]

pub fn flatten(curried: K1<K2P1_1<C, A>, B>) -> Self[src]

pub fn unflatten(self) -> K1<K2P1_1<C, A>, B>[src]

Trait Implementations

impl<Me: ?Sized + Kind2<T, U>, T, U> Clone for K2<Me, T, U> where
    <Me as Kind2<T, U>>::Inner: Clone
[src]

impl<Me: ?Sized + Kind2<T, U>, T, U> Debug for K2<Me, T, U> where
    <Me as Kind2<T, U>>::Inner: Debug
[src]

impl<C: Kind2<A, B>, A, B> From<K1<K2P1_1<C, A>, B>> for K2<C, A, B>[src]

impl<C: Kind2<A, B>, A, B> From<K1<K2P1_2<C, B>, A>> for K2<C, A, B>[src]

impl<C: Kind2<A, B>, A, B> From<K2<C, A, B>> for K1<K2P1_1<C, A>, B>[src]

impl<C: Kind2<A, B>, A, B> From<K2<C, A, B>> for K1<K2P1_2<C, B>, A>[src]

impl<Me: ?Sized + Kind2<T, U>, T, U> PartialEq<K2<Me, T, U>> for K2<Me, T, U> where
    <Me as Kind2<T, U>>::Inner: PartialEq
[src]

Auto Trait Implementations

impl<Me: ?Sized, T, U> RefUnwindSafe for K2<Me, T, U> where
    Me: RefUnwindSafe,
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<Me, T, U> !Send for K2<Me, T, U>

impl<Me, T, U> !Sync for K2<Me, T, U>

impl<Me: ?Sized, T, U> Unpin for K2<Me, T, U> where
    Me: Unpin,
    T: Unpin,
    U: Unpin

impl<Me: ?Sized, T, U> UnwindSafe for K2<Me, T, U> where
    Me: UnwindSafe,
    T: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.