Trait tozny_auth::protocol::Newtype [-] [+] [src]

pub trait Newtype<T: Deref> {
    fn unwrap(self) -> T;
    fn as_slice(&self) -> &<T as Deref>::Target;
}

Abstraction for a type wrapper around a generic type.

It is helpful to put application-specific type wrappers around generic types. For example, UserId and SessinoId are really String values. But wrapping them in specific types allows to compiler to catch errors, such as arguments that are given in the wrong order.

Required Methods

fn unwrap(self) -> T

fn as_slice(&self) -> &<T as Deref>::Target

Implementors