ValueTrait

Trait ValueTrait 

Source
pub trait ValueTrait:
    Display
    + Debug
    + Clone
    + PartialEq
    + PartialOrd
    + Hash
    + Serialize
    + for<'a> Deserialize<'a>
    + Default {
    type Inner;

    // Required methods
    fn new(inner: Self::Inner) -> Self;
    fn inner(&self) -> &Self::Inner;
    fn inner_mut(&mut self) -> &mut Self::Inner;
    fn into_inner(self) -> Self::Inner;
}
Expand description

A trait that all values must implement It enforces a set of common traits and accessors

Required Associated Types§

Source

type Inner

The inner type of the value

Required Methods§

Source

fn new(inner: Self::Inner) -> Self

Creates a new value from the given inner value

Source

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

Returns a reference to the inner value

Source

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

Returns a mutable reference to the inner value

Source

fn into_inner(self) -> Self::Inner

Consumes the value and returns the inner value

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§