Skip to content

Commit 6121885

Browse files
committed
Rename EnumBuilderVariant -> EnumBuilderKind
1 parent 1bcfddf commit 6121885

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

bindgen/codegen/mod.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,11 +3275,11 @@ struct EnumBuilder {
32753275
/// The representation of the enum, e.g. `u32`.
32763276
repr: syn::Type,
32773277
/// The enum kind we are generating
3278-
kind: EnumBuilderVariant,
3278+
kind: EnumBuilderKind,
32793279
}
32803280

32813281
/// A helper type to construct different enum variations.
3282-
enum EnumBuilderVariant {
3282+
enum EnumBuilderKind {
32833283
Rust {
32843284
non_exhaustive: bool,
32853285
},
@@ -3300,7 +3300,7 @@ enum EnumBuilderVariant {
33003300
impl EnumBuilder {
33013301
/// Returns true if the builder is for a rustified enum.
33023302
fn is_rust_enum(&self) -> bool {
3303-
matches!(self.kind, EnumBuilderVariant::Rust { .. })
3303+
matches!(self.kind, EnumBuilderKind::Rust { .. })
33043304
}
33053305

33063306
/// Create a new enum given an item builder, a canonical name, a name for
@@ -3321,17 +3321,17 @@ impl EnumBuilder {
33213321
EnumVariation::NewType {
33223322
is_bitfield,
33233323
is_global,
3324-
} => EnumBuilderVariant::NewType {
3324+
} => EnumBuilderKind::NewType {
33253325
is_bitfield,
33263326
is_global,
33273327
is_anonymous: enum_is_anonymous,
33283328
},
33293329

33303330
EnumVariation::Rust { non_exhaustive } => {
3331-
EnumBuilderVariant::Rust { non_exhaustive }
3331+
EnumBuilderKind::Rust { non_exhaustive }
33323332
}
33333333

3334-
EnumVariation::Consts => EnumBuilderVariant::Consts {
3334+
EnumVariation::Consts => EnumBuilderKind::Consts {
33353335
needs_typedef: !has_typedef,
33363336
},
33373337

@@ -3341,7 +3341,7 @@ impl EnumBuilder {
33413341
Span::call_site(),
33423342
);
33433343

3344-
EnumBuilderVariant::ModuleConsts {
3344+
EnumBuilderKind::ModuleConsts {
33453345
module_name: ident.clone(),
33463346
}
33473347
}
@@ -3377,7 +3377,7 @@ impl EnumBuilder {
33773377
};
33783378

33793379
match self.kind {
3380-
EnumBuilderVariant::Rust { .. } => {
3380+
EnumBuilderKind::Rust { .. } => {
33813381
let name = ctx.rust_ident(variant_name);
33823382
enum_variants.push(EnumVariantInfo {
33833383
variant_name: name,
@@ -3387,7 +3387,7 @@ impl EnumBuilder {
33873387
self
33883388
}
33893389

3390-
EnumBuilderVariant::NewType { is_global, .. } => {
3390+
EnumBuilderKind::NewType { is_global, .. } => {
33913391
let variant_ident = if is_ty_named && !is_global {
33923392
ctx.rust_ident(variant_name)
33933393
} else {
@@ -3407,7 +3407,7 @@ impl EnumBuilder {
34073407
self
34083408
}
34093409

3410-
EnumBuilderVariant::Consts { .. } => {
3410+
EnumBuilderKind::Consts { .. } => {
34113411
let constant_name = match mangling_prefix {
34123412
Some(prefix) => {
34133413
Cow::Owned(format!("{prefix}_{variant_name}"))
@@ -3424,7 +3424,7 @@ impl EnumBuilder {
34243424

34253425
self
34263426
}
3427-
EnumBuilderVariant::ModuleConsts { .. } => {
3427+
EnumBuilderKind::ModuleConsts { .. } => {
34283428
let name = ctx.rust_ident(variant_name);
34293429
enum_variants.push(EnumVariantInfo {
34303430
variant_name: name,
@@ -3492,7 +3492,7 @@ impl EnumBuilder {
34923492

34933493
// 1. Construct a list of the enum variants
34943494
let variants = match self.kind {
3495-
EnumBuilderVariant::Rust { .. } => {
3495+
EnumBuilderKind::Rust { .. } => {
34963496
let mut variants = vec![];
34973497

34983498
for (variant_ident, variant_doc, variant_value) in
@@ -3511,7 +3511,7 @@ impl EnumBuilder {
35113511
}
35123512
variants
35133513
}
3514-
EnumBuilderVariant::NewType { .. } => {
3514+
EnumBuilderKind::NewType { .. } => {
35153515
let mut variants = vec![];
35163516

35173517
for (variant_ident, variant_doc, variant_value) in
@@ -3524,8 +3524,8 @@ impl EnumBuilder {
35243524
}
35253525
variants
35263526
}
3527-
EnumBuilderVariant::Consts { .. } |
3528-
EnumBuilderVariant::ModuleConsts { .. } => {
3527+
EnumBuilderKind::Consts { .. } |
3528+
EnumBuilderKind::ModuleConsts { .. } => {
35293529
let mut variants = vec![];
35303530

35313531
for (variant_ident, variant_doc, variant_value) in
@@ -3544,7 +3544,7 @@ impl EnumBuilder {
35443544

35453545
// 2. Generate the enum representation
35463546
let enum_ = match self.kind {
3547-
EnumBuilderVariant::Rust { non_exhaustive } => {
3547+
EnumBuilderKind::Rust { non_exhaustive } => {
35483548
let non_exhaustive_opt =
35493549
non_exhaustive.then(attributes::non_exhaustive);
35503550

@@ -3559,7 +3559,7 @@ impl EnumBuilder {
35593559
}
35603560
}
35613561
}
3562-
EnumBuilderVariant::NewType {
3562+
EnumBuilderKind::NewType {
35633563
is_bitfield,
35643564
is_global,
35653565
is_anonymous,
@@ -3595,7 +3595,7 @@ impl EnumBuilder {
35953595
pub struct #enum_ident (pub #enum_repr);
35963596
}
35973597
}
3598-
EnumBuilderVariant::Consts { needs_typedef } => {
3598+
EnumBuilderKind::Consts { needs_typedef } => {
35993599
let typedef_opt = needs_typedef.then(|| {
36003600
quote! {
36013601
#( #attrs )*
@@ -3608,7 +3608,7 @@ impl EnumBuilder {
36083608
#typedef_opt
36093609
}
36103610
}
3611-
EnumBuilderVariant::ModuleConsts { module_name, .. } => {
3611+
EnumBuilderKind::ModuleConsts { module_name, .. } => {
36123612
quote! {
36133613
// todo: Probably some attributes, e.g. `cfg` should apply to the `mod`.
36143614
pub mod #module_name {

0 commit comments

Comments
 (0)