[−][src]Trait sum_type::SumType
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
fn variant(&self) -> &'static str
The name of the current variant.
fn variants(&self) -> &'static [&'static str]
A list of all possible variants.
fn downcast_ref<T: Any>(&self) -> Option<&T>
Try to get a reference to the inner field if it is a T
.
fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
Return a mutable reference to the inner field if it is a T
.
fn variant_is<T: Any>(&self) -> bool
Is the underlying variant an instance of T
?