#[repr(C)]pub struct EnumType {
pub repr: Repr,
pub enum_repr: EnumRepr,
pub variants: &'static [Variant],
pub is_cow: bool,
}Expand description
Fields for enum types
Fields§
§repr: ReprRepresentation of the enum’s data
enum_repr: EnumReprrepresentation of the enum’s discriminant (u8, u16, etc.)
variants: &'static [Variant]all variants for this enum
is_cow: boolWhether this enum has cow-like semantics (Borrowed/Owned variants).
When true, deserializers should automatically select the Owned variant
when borrowing is disabled, rather than failing to deserialize &str.
Implementations§
Source§impl EnumType
impl EnumType
Sourcepub fn borrowed_variant(&self) -> Option<&'static Variant>
pub fn borrowed_variant(&self) -> Option<&'static Variant>
Returns the “Borrowed” variant if this is a cow-like enum.
For cow-like enums (#[facet(cow)]), this returns the variant named “Borrowed”.
Sourcepub fn owned_variant(&self) -> Option<&'static Variant>
pub fn owned_variant(&self) -> Option<&'static Variant>
Returns the “Owned” variant if this is a cow-like enum.
For cow-like enums (#[facet(cow)]), this returns the variant named “Owned”.
Trait Implementations§
impl Copy for EnumType
Auto Trait Implementations§
impl Freeze for EnumType
impl RefUnwindSafe for EnumType
impl Send for EnumType
impl Sync for EnumType
impl Unpin for EnumType
impl UnsafeUnpin for EnumType
impl UnwindSafe for EnumType
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