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

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

The wrapped type

Loading content...

Provided methods

fn convert_from(v: Self::Inner) -> Self where
    Self: Sized,
    Self::Inner: Sized

Converts a T value to Self.

fn convert_ref_from(v: &Self::Inner) -> &Self

Converts a reference to T to a reference to Self.

fn convert_mut_from(v: &mut Self::Inner) -> &mut Self

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

fn convert_into(self) -> Self::Inner where
    Self: Sized,
    Self::Inner: Sized

Converts self to a T value.

fn convert_ref_to(&self) -> &Self::Inner

Converts a reference to Self to a reference to T.

fn convert_mut_to(&mut self) -> &mut Self::Inner

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

Loading content...

Implementors

Loading content...