Struct uniffi_bindgen::interface::Enum
source · pub struct Enum {
pub(super) name: String,
pub(super) module_path: String,
pub(super) discr_type: Option<Type>,
pub(super) variants: Vec<Variant>,
pub(super) flat: bool,
pub(super) non_exhaustive: bool,
pub(super) docstring: Option<String>,
}
Expand description
Represents an enum with named variants, each of which may have named and typed fields.
Enums are passed across the FFI by serializing to a bytebuffer, with a i32 indicating the variant followed by the serialization of each field.
Fields§
§name: String
§module_path: String
§discr_type: Option<Type>
§variants: Vec<Variant>
§flat: bool
§non_exhaustive: bool
§docstring: Option<String>
Implementations§
source§impl Enum
impl Enum
pub fn name(&self) -> &str
pub fn variants(&self) -> &[Variant]
pub fn variant_discr(&self, variant_index: usize) -> Result<Literal>
pub fn variant_discr_type(&self) -> &Option<Type>
pub fn is_flat(&self) -> bool
pub fn is_non_exhaustive(&self) -> bool
pub fn iter_types(&self) -> TypeIterator<'_>
pub fn docstring(&self) -> Option<&str>
pub fn try_from_meta(meta: EnumMetadata, flat: bool) -> Result<Self>
Trait Implementations§
source§impl PartialEq<Enum> for Enum
impl PartialEq<Enum> for Enum
impl Eq for Enum
impl StructuralEq for Enum
impl StructuralPartialEq for Enum
Auto Trait Implementations§
impl RefUnwindSafe for Enum
impl Send for Enum
impl Sync for Enum
impl Unpin for Enum
impl UnwindSafe for Enum
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