Struct fuels_types::enum_variants::EnumVariants
source · pub struct EnumVariants { /* private fields */ }
Implementations§
source§impl EnumVariants
impl EnumVariants
pub fn new(
variants: Vec<(String, ParamType)>
) -> Result<EnumVariants, CodecError>
pub fn variants(&self) -> &Vec<(String, ParamType)> ⓘ
pub fn param_types(&self) -> Vec<ParamType> ⓘ
pub fn select_variant(
&self,
discriminant: u8
) -> Result<&(String, ParamType), CodecError>
pub fn only_units_inside(&self) -> bool
sourcepub fn compute_encoding_width_of_enum(&self) -> usize
pub fn compute_encoding_width_of_enum(&self) -> usize
Calculates how many WORDs are needed to encode an enum.
sourcepub fn compute_padding_amount(&self, variant_param_type: &ParamType) -> usize
pub fn compute_padding_amount(&self, variant_param_type: &ParamType) -> usize
Determines the padding needed for the provided enum variant (based on the width of the biggest variant) and returns it.
Trait Implementations§
source§impl Clone for EnumVariants
impl Clone for EnumVariants
source§fn clone(&self) -> EnumVariants
fn clone(&self) -> EnumVariants
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 EnumVariants
impl Debug for EnumVariants
source§impl PartialEq<EnumVariants> for EnumVariants
impl PartialEq<EnumVariants> for EnumVariants
source§fn eq(&self, other: &EnumVariants) -> bool
fn eq(&self, other: &EnumVariants) -> bool
impl Eq for EnumVariants
impl StructuralEq for EnumVariants
impl StructuralPartialEq for EnumVariants
Auto Trait Implementations§
impl RefUnwindSafe for EnumVariants
impl Send for EnumVariants
impl Sync for EnumVariants
impl Unpin for EnumVariants
impl UnwindSafe for EnumVariants
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.