Skip to content

Commit c8016c1

Browse files
committed
Document enum variation precedence
1 parent 7b99b25 commit c8016c1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib.rs

+17
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,23 @@ impl Default for CodegenConfig {
155155
/// // Write the generated bindings to an output file.
156156
/// bindings.write_to_file("path/to/output.rs")?;
157157
/// ```
158+
///
159+
/// # Enums
160+
///
161+
/// Bindgen can map C/C++ enums into Rust in different ways. The way bindgen maps enums depends on
162+
/// the pattern passed to several methods:
163+
///
164+
/// 1. [`bitfield_enum()`](#method.bitfield_enum)
165+
/// 2. [`constified_enum_module()`](#method.constified_enum_module)
166+
/// 3. [`rustified_enum()`](#method.rustified_enum)
167+
///
168+
/// For each C enum, bindgen tries to match the pattern in the following order:
169+
///
170+
/// 1. Bitfield enum
171+
/// 2. Constified enum module
172+
/// 3. Rustified enum
173+
///
174+
/// If none of the above patterns match, then bindgen will generate a set of Rust constants.
158175
#[derive(Debug, Default)]
159176
pub struct Builder {
160177
options: BindgenOptions,

0 commit comments

Comments
 (0)