Skip to content

Commit

Permalink
Updated to latest deps and fixed bitflags example buildbreak
Browse files Browse the repository at this point in the history
  • Loading branch information
budziq committed Sep 24, 2017
1 parent 5b050b3 commit c3a5a7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ publish = false
build = "build.rs"

[dependencies]
base64 = "0.6"
bitflags = "0.9"
base64 = "0.7"
bitflags = "1.0"
byteorder = "1.0"
chrono = "0.4"
clap = "2.26"
Expand All @@ -18,7 +18,7 @@ csv = "1.0.0-beta.4"
data-encoding = "2.0.0-rc.1"
env_logger = "0.4"
error-chain = "0.11"
flate2 = "0.2.19"
flate2 = "0.2"
glob = "0.2"
image = "0.15"
lazy_static = "0.2"
Expand Down
26 changes: 13 additions & 13 deletions src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ bitflags! {
const FLAG_A = 0b00000001;
const FLAG_B = 0b00000010;
const FLAG_C = 0b00000100;
const FLAG_ABC = FLAG_A.bits
| FLAG_B.bits
| FLAG_C.bits;
const FLAG_ABC = Self::FLAG_A.bits
| Self::FLAG_B.bits
| Self::FLAG_C.bits;
}
}

Expand All @@ -781,19 +781,19 @@ impl fmt::Display for MyFlags {
}

fn main() {
let e1 = FLAG_A | FLAG_C;
let e2 = FLAG_B | FLAG_C;
assert_eq!((e1 | e2), FLAG_ABC); // union
assert_eq!((e1 & e2), FLAG_C); // intersection
assert_eq!((e1 - e2), FLAG_A); // set difference
assert_eq!(!e2, FLAG_A); // set complement

let mut flags = FLAG_ABC;
let e1 = MyFlags::FLAG_A | MyFlags::FLAG_C;
let e2 = MyFlags::FLAG_B | MyFlags::FLAG_C;
assert_eq!((e1 | e2), MyFlags::FLAG_ABC); // union
assert_eq!((e1 & e2), MyFlags::FLAG_C); // intersection
assert_eq!((e1 - e2), MyFlags::FLAG_A); // set difference
assert_eq!(!e2, MyFlags::FLAG_A); // set complement

let mut flags = MyFlags::FLAG_ABC;
assert_eq!(format!("{}", flags), "00000000000000000000000000000111");
assert_eq!(format!("{}", flags.clear()), "00000000000000000000000000000000");
// Debug trait is automatically derived for the MyFlags through `bitflags!`
assert_eq!(format!("{:?}", FLAG_B), "FLAG_B");
assert_eq!(format!("{:?}", FLAG_A | FLAG_B), "FLAG_A | FLAG_B");
assert_eq!(format!("{:?}", MyFlags::FLAG_B), "FLAG_B");
assert_eq!(format!("{:?}", MyFlags::FLAG_A | MyFlags::FLAG_B), "FLAG_A | FLAG_B");
}
```

Expand Down

0 comments on commit c3a5a7d

Please sign in to comment.