MetaAny

Trait MetaAny 

Source
pub unsafe trait MetaAny {
    // Required methods
    fn as_erased(&self) -> ErasedInner<'_>;
    fn as_erased_mut(&mut self) -> ErasedInnerMut<'_>;
    fn as_erased_ptr(&self) -> ErasedInnerPtr<'_>;
}
Expand description

A dyn compatible alternative to Any that can contain multiple items.

§Safety

This trait cannot return overlapping references for different types.

For example

struct A{
    b: B,
    c: C,
}

The implementation can return A, or (B, C) but not both.

Required Methods§

Implementations§

Source§

impl dyn MetaAny + '_

Source

pub fn get<T: 'static>(&self) -> Option<&T>

Obtain an item if it exists in the MetaAny.

Always returns Some for ().

Source

pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>

Obtain an item if it exists in the MetaAny.

Always returns Some for ().

Source§

impl dyn MetaAny + '_

Source

pub fn get_ptr<T: 'static>(&self) -> Option<*mut T>

Obtain an item if it exists in the MetaAny.

Always returns Some for ().

Implementations on Foreign Types§

Source§

impl MetaAny for ()

Source§

impl<T: 'static> MetaAny for Option<T>

Source§

impl<T: MetaAny + ?Sized> MetaAny for &T

Source§

impl<T: MetaAny + ?Sized> MetaAny for &mut T

Implementors§

Source§

impl MetaAny for DynMetaTuple

Source§

impl<A: MetaTuple, B: MetaTuple> MetaAny for Join<A, B>

Source§

impl<T: 'static> MetaAny for MetaItem<T>