MetaTag

Trait MetaTag 

Source
pub trait MetaTag:
    Any
    + Debug
    + Display
    + MetaTagClone
    + Send
    + Sync { }
Expand description

Core trait that must be implemented by all structs representing metadata.

This trait requires implementers to also implement MetaTagClone, which is required to enable cloning of Box<dyn MetaTag> objects. The Display impl of the metadata type is used by rustronomy when printing the metadata contents of a container.

§Methods

Although the MetaTag trait itself doesn’t contain any methods, there are a couple methods implemented for dyn MetaTag. Most of these are copies from methods implemented in std for dyn Any.

Implementations§

Source§

impl dyn MetaTag

Source

pub fn is<T: Any>(&self) -> bool

Returns true if self is of type T, false otherwise

Source

pub fn downcast<T: Any + Clone>(&self) -> Option<T>

Casts &self to T by cloning &T. This requires T to impl Clone. If self does not have type T, this method returns None.

Source

pub fn downcast_ref<T: Any>(&self) -> Option<&T>

Casts &self to &T. If self does not have type T, this method returns None.

Source

pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>

Casts &mut self to &mut T. If self does not have type T, this method returns None.

Trait Implementations§

Source§

impl Clone for Box<dyn MetaTag>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§