Trait sum_type::SumType[][src]

pub trait SumType {
    fn variant(&self) -> &'static str;
fn variants(&self) -> &'static [&'static str];
fn downcast_ref<T: Any>(&self) -> Option<&T>;
fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>;
fn variant_is<T: Any>(&self) -> bool; }

Various methods for introspection and dynamic typing.

Note

This trait is automatically implemented for all types generated by the sum_type!() macro. You should never need to implement it manually.

Required Methods

The name of the current variant.

A list of all possible variants.

Try to get a reference to the inner field if it is a T.

Return a mutable reference to the inner field if it is a T.

Is the underlying variant an instance of T?

Implementors