summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Finkenauer <tmfinken@gmail.com>2018-03-12 22:48:17 -0400
committerTravis Finkenauer <tmfinken@gmail.com>2018-03-12 22:48:17 -0400
commitc8016c1a1f207cdb91e9954a5f5dc97c5a51c9ae (patch)
treeaaef3a94651d77b73fbefc20d0ca7c8af1e0a120
parent7b99b2512921fd7540a0b8f9717c6e38fec376e1 (diff)
Document enum variation precedence
-rw-r--r--src/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index db58f6f4..12b38257 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -155,6 +155,23 @@ impl Default for CodegenConfig {
/// // Write the generated bindings to an output file.
/// bindings.write_to_file("path/to/output.rs")?;
/// ```
+///
+/// # Enums
+///
+/// Bindgen can map C/C++ enums into Rust in different ways. The way bindgen maps enums depends on
+/// the pattern passed to several methods:
+///
+/// 1. [`bitfield_enum()`](#method.bitfield_enum)
+/// 2. [`constified_enum_module()`](#method.constified_enum_module)
+/// 3. [`rustified_enum()`](#method.rustified_enum)
+///
+/// For each C enum, bindgen tries to match the pattern in the following order:
+///
+/// 1. Bitfield enum
+/// 2. Constified enum module
+/// 3. Rustified enum
+///
+/// If none of the above patterns match, then bindgen will generate a set of Rust constants.
#[derive(Debug, Default)]
pub struct Builder {
options: BindgenOptions,