! / 0 0 0 0 4 ` // 96 ` bitflags-a5765347a1f15202.0.o/ rust.metadata.bin/ bitflags-a5765347a1f15202.0.bytecode.deflate/ /0 0 0 0 644 624 ` ELF>@@ .text.bssbitflags.0.rs.note.GNU-stack.strtab.symtab.data*p@@:@@@2@0/31 0 0 0 644 13489 ` 4rustc 1.7.0-nightly (7ce713961 2015-12-11)bitflagsx86_64-unknown-linux-gnua630419987c88d792/0doc1//! A typesafe bitmask flag generator.56std7f5557ea25d721441856core7fb31bea8827d7308856collections769a8c0af662a3b2c856rustc_unicode724abb4103b1d2f02856alloc73a0b87884878ff61856rand7e8ea4bd77d954913856libc71725371bfa776c78856alloc_jemalloc7e48d82923c6a08528 /home/hobofan/.cargo/registry/src/github.com-88ac128001ac3a9a/bitflags-0.4.0/src/lib.rsL1UA?#EB@A$'JQR9+ Q9KKM+-----. ""3:<<E)) "PT "? )#1I7I KPGO>NNB%":KQQE:6PQ55Q6D E W8cKMMNMN#$-LPV9G@HF&.NJ,>"/F$ /*&6(L$V7&<E'HOV<9SN1?<A-,?+*UA,X?)69)69*69) 8%<<; 9%N=; 9%H=; 6%E:< 6%=(B Kl0'( 6E "<  , .T9',Y,,!&++,-   - &'  7.0=/ >78@3K #A:;EF=\ ,$&* ("#' -!!%6 3!% $% ' $  #"'4  1 $ $ " 3  4;==5&1/3 KVR $$'$ $$#""""%4 $$'' EQ 3L2LL2O*LN! L()% ':N"N~N"NNNNONL)OPO+PPP%48PRPK=) NRR5RR6S.R6O"NS/SS/SU; SE NB",NU<UU<UV:UB)V;WV;OG6<OWYW:O :9<O :Y[nYBOJO[o\[o*7.,;\^E \ MNHMI*E*@ bitflags2֌/0doc1/// The `bitflags!` macro generates a `struct` that holds a set of C-style2֌/0doc1/// bitmask flags. It is useful for creating typesafe wrappers for C APIs.2/0doc1///2،/0doc1/// The flags should only be defined for integer types, otherwise unexpected2/0doc1/// type errors may occur at compile time.2/0doc1///2/0doc1/// # Example2/0doc1///2/0doc1/// ```{.rust}2/0doc1/// #[macro_use]2/0doc1/// extern crate bitflags;2/0doc1///2/0doc1/// bitflags! {2/0doc1/// flags Flags: u32 {2/0doc1/// const FLAG_A = 0b00000001,2/0doc1/// const FLAG_B = 0b00000010,2/0doc1/// const FLAG_C = 0b00000100,2/0doc1/// const FLAG_ABC = FLAG_A.bits2/0doc1/// | FLAG_B.bits2/0doc1/// | FLAG_C.bits,2/0doc1/// }2/0doc1/// }2/0doc1///2/0doc1/// fn main() {2/0doc1/// let e1 = FLAG_A | FLAG_C;2/0doc1/// let e2 = FLAG_B | FLAG_C;2/0doc1/// assert!((e1 | e2) == FLAG_ABC); // union2Ō/0doc1/// assert!((e1 & e2) == FLAG_C); // intersection2nj/0doc1/// assert!((e1 - e2) == FLAG_A); // set difference2nj/0doc1/// assert!(!e2 == FLAG_A); // set complement2/0doc1/// }2/0doc1/// ```2/0doc1///2Ќ/0doc1/// The generated `struct`s can also be extended with type and trait2/0doc1/// implementations:2/0doc1///2/0doc1/// ```{.rust}2/0doc1/// #[macro_use]2/0doc1/// extern crate bitflags;2/0doc1///2/0doc1/// use std::fmt;2/0doc1///2/0doc1/// bitflags! {2/0doc1/// flags Flags: u32 {2/0doc1/// const FLAG_A = 0b00000001,2/0doc1/// const FLAG_B = 0b00000010,2/0doc1/// }2/0doc1/// }2/0doc1///2/0doc1/// impl Flags {2/0doc1/// pub fn clear(&mut self) {2ی/0doc1/// self.bits = 0; // The `bits` field can be accessed from within the2ߌ/0doc1/// // same module where the `bitflags!` macro was invoked.2/0doc1/// }2/0doc1/// }2/0doc1///2/0doc1/// impl fmt::Display for Flags {2ʌ/0doc1/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {2/0doc1/// write!(f, "hi!")2/0doc1/// }2/0doc1/// }2/0doc1///2/0doc1/// fn main() {2/0doc1/// let mut flags = FLAG_A | FLAG_B;2/0doc1/// flags.clear();2/0doc1/// assert!(flags.is_empty());2/0doc1/// assert_eq!(format!("{}", flags), "hi!");2Ԍ/0doc1/// assert_eq!(format!("{:?}", FLAG_A | FLAG_B), "FLAG_A | FLAG_B");2Œ/0doc1/// assert_eq!(format!("{:?}", FLAG_B), "FLAG_B");2/0doc1/// }2/0doc1/// ```2/0doc1///2/0doc1/// # Attributes2/0doc1///2Ԍ/0doc1/// Attributes can be attached to the generated `struct` by placing them2/0doc1/// before the `flags` keyword.2/0doc1///2/0doc1/// # Trait implementations2/0doc1///2֌/0doc1/// The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash`2ی/0doc1/// traits automatically derived for the `struct` using the `derive` attribute.2Ҍ/0doc1/// Additional traits can be derived by providing an explicit `derive`2/0doc1/// attribute on `flags`.2/0doc1///2ڌ/0doc1/// The `FromIterator` trait is implemented for the `struct`, too, calculating2Ɍ/0doc1/// the union of the instances of the `struct` iterated over.2/0doc1///2ٌ/0doc1/// The `Debug` trait is also implemented by displaying the bits value of the2/0doc1/// internal struct.2/0doc1///2/0doc1/// ## Operators2/0doc1///2ٌ/0doc1/// The following operator traits are implemented for the generated `struct`:2/0doc1///2/0doc1/// - `BitOr`: union2/0doc1/// - `BitAnd`: intersection2/0doc1/// - `BitXor`: toggle2/0doc1/// - `Sub`: set difference2/0doc1/// - `Not`: set complement2/0doc1///2/0doc1/// # Methods2/0doc1///2͌/0doc1/// The following methods are defined for the generated `struct`:2/0doc1///2/0doc1/// - `empty`: an empty set of flags2/0doc1/// - `all`: the set of all flags2Ō/0doc1/// - `bits`: the raw value of the flags currently stored2֌/0doc1/// - `from_bits`: convert from underlying bit representation, unless that2܌/0doc1/// representation contains bits that do not correspond to a flag2܌/0doc1/// - `from_bits_truncate`: convert from underlying bit representation, dropping2Ќ/0doc1/// any bits that do not correspond to flags2Ō/0doc1/// - `is_empty`: `true` if no flags are currently stored2/0doc1/// - `is_all`: `true` if all flags are currently set2ی/0doc1/// - `intersects`: `true` if there are flags common to both `self` and `other`2܌/0doc1/// - `contains`: `true` all of the flags in `other` are contained within `self`2/0doc1/// - `insert`: inserts the specified flags in-place2/0doc1/// - `remove`: removes the specified flags in-place2܌/0doc1/// - `toggle`: the specified flags will be inserted if not present, and removed2/0doc1/// if they are.230macro_exportT( $ ( # [ $ attr : meta ] ) * flags $ BitFlags : ident : $ T : ty { $ ( $ ( # [ $ Flag_attr : meta ] ) * const $ Flag : ident = $ value : expr ) , + } ) => { # [ derive ( Copy , PartialEq , Eq , Clone , PartialOrd , Ord , Hash ) ] $ ( # [ $ attr ] ) * pub struct $ BitFlags { bits : $ T , } $ ( $ ( # [ $ Flag_attr ] ) * pub const $ Flag : $ BitFlags = $ BitFlags { bits : $ value } ; ) + impl $ crate:: __core:: fmt:: Debug for $ BitFlags { fn fmt ( & self , f : & mut $ crate:: __core:: fmt:: Formatter ) -> $ crate:: __core:: fmt:: Result { # [ allow ( dead_code ) ] # [ allow ( unused_assignments ) ] mod dummy { $ ( const $ Flag : super:: $ BitFlags = super:: $ BitFlags { bits : 0 } ; ) + # [ inline ] pub fn fmt ( self_ : & super:: $ BitFlags , f : & mut $ crate:: __core:: fmt:: Formatter ) -> $ crate:: __core:: fmt:: Result { use super:: * ; let mut first = true ; $ ( if $ Flag . bits != 0 && self_ . contains ( $ Flag ) { if ! first { try ! ( f . write_str ( " | " ) ) ; } first = false ; try ! ( f . write_str ( stringify ! ( $ Flag ) ) ) ; } ) + Ok ( ( ) ) } } dummy:: fmt ( self , f ) } } # [ allow ( dead_code ) ] impl $ BitFlags { /// Returns an empty set of flags. # [ inline ] pub fn empty ( ) -> $ BitFlags { $ BitFlags { bits : 0 } } /// Returns the set containing all flags. # [ inline ] pub fn all ( ) -> $ BitFlags { # [ allow ( dead_code ) ] mod dummy { $ ( const $ Flag : super:: $ BitFlags = super:: $ BitFlags { bits : 0 } ; ) + # [ inline ] pub fn all ( ) -> super:: $ BitFlags { use super:: * ; $ BitFlags { bits : $ ( $ Flag . bits ) | + } } } dummy:: all ( ) } /// Returns the raw value of the flags currently stored. # [ inline ] pub fn bits ( & self ) -> $ T { self . bits } /// Convert from underlying bit representation, unless that /// representation contains bits that do not correspond to a flag. # [ inline ] pub fn from_bits ( bits : $ T ) -> $ crate:: __core:: option:: Option < $ BitFlags > { if ( bits & ! $ BitFlags:: all ( ) . bits ( ) ) != 0 { $ crate:: __core:: option:: Option:: None } else { $ crate:: __core:: option:: Option:: Some ( $ BitFlags { bits : bits } ) } } /// Convert from underlying bit representation, dropping any bits /// that do not correspond to flags. # [ inline ] pub fn from_bits_truncate ( bits : $ T ) -> $ BitFlags { $ BitFlags { bits : bits } & $ BitFlags:: all ( ) } /// Returns `true` if no flags are currently stored. # [ inline ] pub fn is_empty ( & self ) -> bool { * self == $ BitFlags:: empty ( ) } /// Returns `true` if all flags are currently set. # [ inline ] pub fn is_all ( & self ) -> bool { * self == $ BitFlags:: all ( ) } /// Returns `true` if there are flags common to both `self` and `other`. # [ inline ] pub fn intersects ( & self , other : $ BitFlags ) -> bool { ! ( * self & other ) . is_empty ( ) } /// Returns `true` all of the flags in `other` are contained within `self`. # [ inline ] pub fn contains ( & self , other : $ BitFlags ) -> bool { ( * self & other ) == other } /// Inserts the specified flags in-place. # [ inline ] pub fn insert ( & mut self , other : $ BitFlags ) { self . bits |= other . bits ; } /// Removes the specified flags in-place. # [ inline ] pub fn remove ( & mut self , other : $ BitFlags ) { self . bits &= ! other . bits ; } /// Toggles the specified flags in-place. # [ inline ] pub fn toggle ( & mut self , other : $ BitFlags ) { self . bits ^= other . bits ; } } impl $ crate:: __core:: ops:: BitOr for $ BitFlags { type Output = $ BitFlags ; /// Returns the union of the two sets of flags. # [ inline ] fn bitor ( self , other : $ BitFlags ) -> $ BitFlags { $ BitFlags { bits : self . bits | other . bits } } } impl $ crate:: __core:: ops:: BitXor for $ BitFlags { type Output = $ BitFlags ; /// Returns the left flags, but with all the right flags toggled. # [ inline ] fn bitxor ( self , other : $ BitFlags ) -> $ BitFlags { $ BitFlags { bits : self . bits ^ other . bits } } } impl $ crate:: __core:: ops:: BitAnd for $ BitFlags { type Output = $ BitFlags ; /// Returns the intersection between the two sets of flags. # [ inline ] fn bitand ( self , other : $ BitFlags ) -> $ BitFlags { $ BitFlags { bits : self . bits & other . bits } } } impl $ crate:: __core:: ops:: Sub for $ BitFlags { type Output = $ BitFlags ; /// Returns the set difference of the two sets of flags. # [ inline ] fn sub ( self , other : $ BitFlags ) -> $ BitFlags { $ BitFlags { bits : self . bits & ! other . bits } } } impl $ crate:: __core:: ops:: Not for $ BitFlags { type Output = $ BitFlags ; /// Returns the complement of this set of flags. # [ inline ] fn not ( self ) -> $ BitFlags { $ BitFlags { bits : ! self . bits } & $ BitFlags:: all ( ) } } impl $ crate:: __core:: iter:: FromIterator < $ BitFlags > for $ BitFlags { fn from_iter < T : $ crate:: __core:: iter:: IntoIterator < Item = $ BitFlags >> ( iterator : T ) -> $ BitFlags { let mut result = Self:: empty ( ) ; for item in iterator { result . insert ( item ) } result } } } ; ( $ ( # [ $ attr : meta ] ) * flags $ BitFlags : ident : $ T : ty { $ ( $ ( # [ $ Flag_attr : meta ] ) * const $ Flag : ident = $ value : expr ) , + , } ) => { bitflags ! { $ ( # [ $ attr ] ) * flags $ BitFlags : $ T { $ ( $ ( # [ $ Flag_attr ] ) * const $ Flag = $ value ) , + } } } ; |{{{FGH__core F"A#!,  $m bitflags{{{=>xyFGH__core4H /50 0 0 0 644 522 ` RUST_OBJECT-?la?W2@<ȡ5q0 B$.6;&4JhJpp!Ѥ0cL#iT &