Skip to main content

PayloadContainer

Trait PayloadContainer 

Source
pub trait PayloadContainer: Sized {
    type Element;

    // Required methods
    fn new_empty() -> Self;
    fn new(element: Self::Element) -> Self;
    fn is_some(&self) -> bool;
    fn as_ref(&self) -> Option<&Self::Element>;
    fn as_mut(&mut self) -> Option<&mut Self::Element>;
    fn replace(&mut self, element: Self::Element) -> Option<Self::Element>;
    fn take(&mut self) -> Option<Self::Element>;
}

Required Associated Types§

Required Methods§

Source

fn new_empty() -> Self

Source

fn new(element: Self::Element) -> Self

Source

fn is_some(&self) -> bool

Source

fn as_ref(&self) -> Option<&Self::Element>

Source

fn as_mut(&mut self) -> Option<&mut Self::Element>

Source

fn replace(&mut self, element: Self::Element) -> Option<Self::Element>

Source

fn take(&mut self) -> Option<Self::Element>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> PayloadContainer for Option<T>

Source§

type Element = T

Source§

fn new_empty() -> Option<T>

Source§

fn new(element: <Option<T> as PayloadContainer>::Element) -> Option<T>

Source§

fn is_some(&self) -> bool

Source§

fn as_ref(&self) -> Option<&<Option<T> as PayloadContainer>::Element>

Source§

fn as_mut(&mut self) -> Option<&mut <Option<T> as PayloadContainer>::Element>

Source§

fn replace( &mut self, element: <Option<T> as PayloadContainer>::Element, ) -> Option<<Option<T> as PayloadContainer>::Element>

Source§

fn take(&mut self) -> Option<<Option<T> as PayloadContainer>::Element>

Implementors§