Struct cbindgen::EnumConfig

source ·
pub struct EnumConfig {
Show 17 fields pub rename_variants: RenameRule, pub rename_variant_name_fields: RenameRule, pub add_sentinel: bool, pub prefix_with_name: bool, pub derive_helper_methods: bool, pub derive_const_casts: bool, pub derive_mut_casts: bool, pub cast_assert_name: Option<String>, pub must_use: Option<String>, pub deprecated: Option<String>, pub deprecated_with_note: Option<String>, pub derive_tagged_enum_destructor: bool, pub derive_tagged_enum_copy_constructor: bool, pub derive_tagged_enum_copy_assignment: bool, pub derive_ostream: bool, pub enum_class: bool, pub private_default_tagged_enum_constructor: bool,
}
Expand description

Settings to apply to generated enums.

Fields§

§rename_variants: RenameRule

The rename rule to apply to the name of enum variants

§rename_variant_name_fields: RenameRule

The rename rule to apply to the names of the union fields in C/C++ generated from the Rust enum. Applied before rename_variants rename rule. Defaults to SnakeCase.

§add_sentinel: bool

Whether to add a Sentinel value at the end of every enum This is useful in Gecko for IPC serialization

§prefix_with_name: bool

Whether the enum variants should be prefixed with the enum name

§derive_helper_methods: bool

Whether to generate static ::X(..) constructors and IsX() methods for tagged enums.

§derive_const_casts: bool

Whether to generate AsX() const methods for tagged enums.

§derive_mut_casts: bool

Whether to generate AsX() methods for tagged enums.

§cast_assert_name: Option<String>

The name of the macro to use for derive_{const,mut}casts. If custom, you’re responsible to provide the necessary header, otherwise assert will be used, and <cassert> will be included.

§must_use: Option<String>

The way to annotation this enum as #[must_use].

§deprecated: Option<String>

The way to annotation this function as #[deprecated] without notes

§deprecated_with_note: Option<String>

The way to annotation this function as #[deprecated] with notes

§derive_tagged_enum_destructor: bool

Whether to generate destructors of tagged enums.

§derive_tagged_enum_copy_constructor: bool

Whether to generate copy-constructors of tagged enums.

§derive_tagged_enum_copy_assignment: bool

Whether to generate copy-assignment operators of tagged enums.

This is only generated if a copy constructor for the same tagged enum is generated as well.

§derive_ostream: bool

Whether to generate a ostream serializer for the struct

§enum_class: bool

Declare the enum as an enum class. Only relevant when targeting C++.

§private_default_tagged_enum_constructor: bool

Whether to generate empty, private default-constructors for tagged enums.

Trait Implementations§

source§

impl Clone for EnumConfig

source§

fn clone(&self) -> EnumConfig

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for EnumConfig

source§

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

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

impl Default for EnumConfig

source§

fn default() -> EnumConfig

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

impl<'de> Deserialize<'de> for EnumConfigwhere EnumConfig: Default,

source§

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

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,