summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Munns <james.munns@gmail.com>2017-06-05 23:20:40 +0200
committerJames Munns <james.munns@gmail.com>2017-06-05 23:20:40 +0200
commitc094c932532988a75557bfa0e6c844d6a1fd117c (patch)
tree38796686b04c8c8e599df4f7a955047458a78624
parent8e2f31d608667a8ea460ce53ee9aa9ee43d32280 (diff)
Ignore rust snippets, and add section referencing CLI args and library methods
-rw-r--r--book/src/using-unions.md18
1 files changed, 15 insertions, 3 deletions
diff --git a/book/src/using-unions.md b/book/src/using-unions.md
index 3f74b2ff..66ba6d13 100644
--- a/book/src/using-unions.md
+++ b/book/src/using-unions.md
@@ -25,11 +25,23 @@ typedef union {
} greek_t;
```
+## Relevant Bindgen Options
+
+### Library
+
+* [`bindgen::Builder::no_unstable_rust()`](https://docs.rs/bindgen/0.25.3/bindgen/struct.Builder.html#method.no_unstable_rust)
+* [`bindgen::Builder::derive_default()`](https://docs.rs/bindgen/0.25.3/bindgen/struct.Builder.html#method.derive_default)
+
+### Command Line
+
+* `--no-unstable-rust`
+* `--with-derive-default`
+
## Using the unstable `union` version
With `struct`s generated by bindgen from C, it is possible to initialize fields in a "normal" rust way:
-```rust
+```rust,ignore
mod bindings;
fn main() {
@@ -42,7 +54,7 @@ fn main() {
When using the unstable `union` type, there are two choices for initialization: Zeroed, and with a specific variant.
-```rust
+```rust,ignore
#![feature(untagged_unions)]
mod bindings_unstable;
@@ -75,7 +87,7 @@ For versions of Rust that do not support the new `union` type, bindgen will gene
Interacting with these unions is slightly different than the new `union` types. Whenever a variant of the union is accessed, it must be done through a reference.
-```rust
+```rust,ignore
mod bindings;
fn stable() {