Skip to main content

EnumDef

Struct EnumDef 

Source
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: bool

True 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: bool

True 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: bool

True 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: bool

True 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: bool

True 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: VersionAnnotation

Version 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 Clone for EnumDef

Source§

fn clone(&self) -> EnumDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumDef

Source§

fn default() -> EnumDef

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for EnumDef

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for EnumDef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more