Struct wasm_component_layer::VariantType
source · pub struct VariantType { /* private fields */ }Expand description
Describes a type has multiple possible states. Each state may optionally have a type associated with it.
Implementations§
source§impl VariantType
impl VariantType
sourcepub fn new(
name: Option<TypeIdentifier>,
cases: impl IntoIterator<Item = VariantCase>
) -> Result<Self>
pub fn new( name: Option<TypeIdentifier>, cases: impl IntoIterator<Item = VariantCase> ) -> Result<Self>
Creates a new type for the given set of variant cases. Each case must have a unique name.
sourcepub fn cases(&self) -> &[VariantCase]
pub fn cases(&self) -> &[VariantCase]
Gets all of the cases for this variant.
sourcepub fn name(&self) -> Option<&TypeIdentifier>
pub fn name(&self) -> Option<&TypeIdentifier>
Gets the name of this type, if any.
Trait Implementations§
source§impl Clone for VariantType
impl Clone for VariantType
source§fn clone(&self) -> VariantType
fn clone(&self) -> VariantType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for VariantType
impl Debug for VariantType
source§impl Hash for VariantType
impl Hash for VariantType
source§impl PartialEq for VariantType
impl PartialEq for VariantType
impl Eq for VariantType
Auto Trait Implementations§
impl !RefUnwindSafe for VariantType
impl Send for VariantType
impl Sync for VariantType
impl Unpin for VariantType
impl !UnwindSafe for VariantType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.