[][src]Trait core_extensions::transparent_newtype::TransparentNewtype

pub unsafe trait TransparentNewtype {
    type Inner: ?Sized;
    pub fn convert_from(v: Self::Inner) -> Self
    where
        Self: Sized,
        Self::Inner: Sized
, { ... }
pub fn convert_ref_from(v: &Self::Inner) -> &Self { ... }
pub fn convert_mut_from(v: &mut Self::Inner) -> &mut Self { ... }
pub fn convert_into(self) -> Self::Inner
    where
        Self: Sized,
        Self::Inner: Sized
, { ... }
pub fn convert_ref_to(&self) -> &Self::Inner { ... }
pub fn convert_mut_to(&mut self) -> &mut Self::Inner { ... } }

Trait for #[repr(transparent)] newtypes (stable since Rust 1.28) which are safe to transmute to/from their contents.

Safety for users of TransparentNewtype types

Look at the module-level documentation

Associated Types

type Inner: ?Sized[src]

The wrapped type

Loading content...

Provided methods

pub fn convert_from(v: Self::Inner) -> Self where
    Self: Sized,
    Self::Inner: Sized
[src]

Converts a T value to Self.

pub fn convert_ref_from(v: &Self::Inner) -> &Self[src]

Converts a reference to T to a reference to Self.

pub fn convert_mut_from(v: &mut Self::Inner) -> &mut Self[src]

Converts a mutable reference to T to a mutable reference to Self.

pub fn convert_into(self) -> Self::Inner where
    Self: Sized,
    Self::Inner: Sized
[src]

Converts self to a T value.

pub fn convert_ref_to(&self) -> &Self::Inner[src]

Converts a reference to Self to a reference to T.

pub fn convert_mut_to(&mut self) -> &mut Self::Inner[src]

Converts a mutable reference to Self to a mutable reference to T.

Loading content...

Implementors

Loading content...