summaryrefslogtreecommitdiff
path: root/libbindgen/src/chooser.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-11 03:07:26 -0800
committerGitHub <noreply@github.com>2017-01-11 03:07:26 -0800
commit6bfeae155155a12849033e1c5199ca6e48e8b22c (patch)
tree4b1a0e42b32238565eb3ab61e67623e13459a06f /libbindgen/src/chooser.rs
parentdf043bf3dcc11bfd5c22cee5d3c6ba04d41c5f00 (diff)
parentfee7e96875f1d7c805a09e8ec8e02988de25e370 (diff)
Auto merge of #393 - emilio:enum-const-api, r=upsuper
Provide an API to constify enum variants. r? @upsuper
Diffstat (limited to 'libbindgen/src/chooser.rs')
-rw-r--r--libbindgen/src/chooser.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbindgen/src/chooser.rs b/libbindgen/src/chooser.rs
index 10a77dc9..51392d70 100644
--- a/libbindgen/src/chooser.rs
+++ b/libbindgen/src/chooser.rs
@@ -1,6 +1,7 @@
//! A public API for more fine-grained customization of bindgen behavior.
pub use ir::int::IntKind;
+pub use ir::enum_ty::{EnumVariantValue, EnumVariantCustomBehavior};
use std::fmt;
/// A trait to allow configuring different kinds of types in different
@@ -11,4 +12,15 @@ pub trait TypeChooser: fmt::Debug {
fn int_macro(&self, _name: &str, _value: i64) -> Option<IntKind> {
None
}
+
+ /// This function should return whether, given the a given enum variant
+ /// name, and value, returns whether this enum variant will forcibly be a
+ /// constant.
+ fn enum_variant_behavior(&self,
+ _enum_name: Option<&str>,
+ _variant_name: &str,
+ _variant_value: EnumVariantValue)
+ -> Option<EnumVariantCustomBehavior> {
+ None
+ }
}