pub struct EnumDef {Show 18 fields
pub name: String,
pub rust_path: String,
pub original_rust_path: String,
pub variants: Vec<EnumVariant>,
pub methods: Vec<MethodDef>,
pub doc: String,
pub cfg: Option<String>,
pub is_copy: bool,
pub has_serde: bool,
pub has_default: bool,
pub serde_tag: Option<String>,
pub serde_untagged: bool,
pub serde_rename_all: Option<String>,
pub binding_excluded: bool,
pub binding_exclusion_reason: Option<String>,
pub excluded_variants: Vec<EnumVariant>,
pub version: VersionAnnotation,
pub string_shorthand: Option<StringShorthand>,
}Expand description
A public enum.
Fields§
§name: String§rust_path: String§original_rust_path: String§variants: Vec<EnumVariant>§methods: Vec<MethodDef>Associated functions (static factory methods) declared in impl EnumName { ... }.
Only associated functions (no self receiver, i.e. is_static = true) are collected here.
Instance methods on enums are not expressible across most FFI boundaries and are excluded.
doc: String§cfg: Option<String>§is_copy: boolTrue if the enum derives Copy. Only unit-variant enums can derive Copy.
Used by FFI codegen to avoid emitting .clone() (which trips clippy::clone_on_copy).
has_serde: boolTrue if the enum derives both serde::Serialize and serde::Deserialize.
Used by host-language emission (e.g. Swift Codable) to gate JSON-bridge conformance.
has_default: boolTrue when the core enum implements Default (via #[derive(Default)] with a
#[default] variant, OR a manual impl Default for Enum). Used by data-enum
wrapper codegen to decide whether to emit a delegating impl Default that calls
<core::Enum as Default>::default(). Without this, enums with a manual impl Default (no #[default] variant) wrongly get no wrapper Default, breaking
structs that contain them.
serde_tag: Option<String>Serde tag property name for internally tagged enums (from #[serde(tag = "...")])
serde_untagged: boolTrue when the enum has #[serde(untagged)].
Absence of serde_tag does NOT imply untagged — it means externally-tagged (the serde
default). Only set this when the attribute is explicitly present on the Rust type.
serde_rename_all: Option<String>Serde rename strategy for enum variants (from #[serde(rename_all = "...")])
binding_excluded: boolTrue when source metadata explicitly excludes this enum from generated
polyglot binding surfaces (via #[cfg_attr(alef, alef(skip))] or #[doc(hidden)]).
binding_exclusion_reason: Option<String>Human-readable reason for binding_excluded, used in diagnostics.
excluded_variants: Vec<EnumVariant>Variants that were stripped from variants because they are variant-level
binding_excluded (via #[cfg_attr(alef, alef(skip))] or #[doc(hidden)]).
Retained here so backends that generate exhaustive Rust match expressions
(e.g. Dart FRB From<CoreType> impls) can emit unreachable!() arms for them.
version: VersionAnnotationVersion annotation (since, deprecated).
string_shorthand: Option<StringShorthand>Optional opt-in mapping from a bare host-language string to a data-carrying
variant’s field. None (the default) means no shorthand: backends that build
the enum from a bare string treat it as a unit-variant name, unchanged.
Set from #[alef(string_shorthand(variant = "...", field = "..."))].
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EnumDef
impl<'de> Deserialize<'de> for EnumDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EnumDef
impl RefUnwindSafe for EnumDef
impl Send for EnumDef
impl Sync for EnumDef
impl Unpin for EnumDef
impl UnsafeUnpin for EnumDef
impl UnwindSafe for EnumDef
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more