pub struct Flags(/* private fields */);
๐Deprecated since 0.3.0: Use
[bool; 8]
directly insteadExpand description
Encodes a set of bit flags packed into a single byte
ยงExamples
use encode::Encodable;
use encode::combinators::Flags;
let mut buf = Vec::new();
Flags::new([false,false,false,false,false,false,false, false]).encode(&mut buf).unwrap();
assert_eq!(&buf, &[0]);
use encode::Encodable;
use encode::combinators::Flags;
let mut buf = Vec::new();
Flags::new([true,false,false,true,false,false,false, false]).encode(&mut buf).unwrap();
assert_eq!(&buf, &[0b1001_0000]);
Implementationsยง
Trait Implementationsยง
Sourceยงimpl<E: ByteEncoder> Encodable<E> for Flags
impl<E: ByteEncoder> Encodable<E> for Flags
Sourceยงimpl Ord for Flags
impl Ord for Flags
1.21.0 ยท Sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Sourceยงimpl PartialOrd for Flags
impl PartialOrd for Flags
impl Copy for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementationsยง
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnwindSafe for Flags
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> EncodableSize for Twhere
T: Encodable<SizeEncoder>,
impl<T> EncodableSize for Twhere
T: Encodable<SizeEncoder>,
Sourceยงfn encoded_size(&self) -> Result<usize, <T as Encodable<SizeEncoder>>::Error>
fn encoded_size(&self) -> Result<usize, <T as Encodable<SizeEncoder>>::Error>
Computes the size of the encoded representation of
self
. Read more