summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs15
-rw-r--r--src/options.rs7
2 files changed, 22 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 66d0a6ca..72770411 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -261,6 +261,10 @@ impl Builder {
output_vector.push("--with-derive-hash".into());
}
+ if self.options.derive_partialord {
+ output_vector.push("--with-derive-partialord".into());
+ }
+
if self.options.derive_partialeq {
output_vector.push("--with-derive-partialeq".into());
}
@@ -814,6 +818,12 @@ impl Builder {
self
}
+ /// Set whether `PartialOrd` should be derived by default.
+ pub fn derive_partialord(mut self, doit: bool) -> Self {
+ self.options.derive_partialord = doit;
+ self
+ }
+
/// Set whether `PartialEq` should be derived by default.
/// If we don't compute partialeq, we also cannot compute
/// eq. Set the derive_eq to `false` when doit is `false`.
@@ -1176,6 +1186,10 @@ struct BindgenOptions {
/// and types.
derive_hash: bool,
+ /// True if we should derive PartialOrd trait implementations for C/C++ structures
+ /// and types.
+ derive_partialord: bool,
+
/// True if we should derive PartialEq trait implementations for C/C++ structures
/// and types.
derive_partialeq: bool,
@@ -1325,6 +1339,7 @@ impl Default for BindgenOptions {
impl_debug: false,
derive_default: false,
derive_hash: false,
+ derive_partialord: false,
derive_partialeq: false,
derive_eq: false,
enable_cxx_namespaces: false,
diff --git a/src/options.rs b/src/options.rs
index 9ebedc5d..b3182270 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -83,6 +83,9 @@ where
Arg::with_name("with-derive-partialeq")
.long("with-derive-partialeq")
.help("Derive partialeq on any type."),
+ Arg::with_name("with-derive-partialord")
+ .long("with-derive-partialord")
+ .help("Derive partialord on any type."),
Arg::with_name("with-derive-eq")
.long("with-derive-eq")
.help("Derive eq on any type. Enable this option also enables --with-derive-partialeq"),
@@ -340,6 +343,10 @@ where
builder = builder.derive_partialeq(true);
}
+ if matches.is_present("with-derive-partialord") {
+ builder = builder.derive_partialord(true);
+ }
+
if matches.is_present("with-derive-eq") {
builder = builder.derive_eq(true);
}