Trait call_by::As[][src]

pub trait As<'a, C: Convention, T: By<'a, C>>: By<'a, C> {
    fn as_convention(this: Self::Type) -> <T as By<'a, C>>::Type;
}

The generalization of Into, AsRef, and AsMut: in a calling-convention polymorphic context, this trait allows you to invoke the appropriate conversion method depending on the applicable calling convention.

Examples

use call_by::*;

fn do_something<'a, T, S, C>(input: <S as By<'a, C>>::Type)
where
    T: By<'a, C>,
    S: By<'a, C> + As<'a, C, T>,
    C: Convention,
{
    let t: <T as By<'a, C>>::Type = S::as_convention(input);
    // ... do something with `t` ...
}

Required methods

fn as_convention(this: Self::Type) -> <T as By<'a, C>>::Type[src]

Loading content...

Implementors

impl<'a, T, S> As<'a, Val, T> for S where
    S: Into<T>, 
[src]

impl<'a, T: 'a, S: 'a> As<'a, Mut, T> for S where
    S: AsMut<T>, 
[src]

impl<'a, T: 'a, S: 'a> As<'a, Ref, T> for S where
    S: AsRef<T>, 
[src]

Loading content...