referrerpolicy=no-referrer-when-downgrade
frame_support::traits

Trait IsType

Source
pub trait IsType<T>: Into<T> + From<T> {
    // Required methods
    fn from_ref(t: &T) -> &Self;
    fn into_ref(&self) -> &T;
    fn from_mut(t: &mut T) -> &mut Self;
    fn into_mut(&mut self) -> &mut T;
}
Expand description

Trait to be used when types are exactly same.

This allow to convert back and forth from type, a reference and a mutable reference.

Required Methods§

Source

fn from_ref(t: &T) -> &Self

Cast reference.

Source

fn into_ref(&self) -> &T

Cast reference.

Source

fn from_mut(t: &mut T) -> &mut Self

Cast mutable reference.

Source

fn into_mut(&mut self) -> &mut T

Cast mutable reference.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> IsType<T> for T