[][src]Struct rust_ipv8::serialization::bits::Bits

pub struct Bits {
    pub bit0: bool,
    pub bit1: bool,
    pub bit2: bool,
    pub bit3: bool,
    pub bit4: bool,
    pub bit5: bool,
    pub bit6: bool,
    pub bit7: bool,
}

This struct represents the bits inside an u8 by unpacking them into booleans.

Mostly here to achieve feature parity with py-ipv8 see py-ipv8 code

Fields

bit0: boolbit1: boolbit2: boolbit3: boolbit4: boolbit5: boolbit6: boolbit7: bool

Methods

impl Bits[src]

pub fn new() -> Self[src]

Creates a Bits struct with every bit set to false

pub fn from_bools(
    data: (bool, bool, bool, bool, bool, bool, bool, bool)
) -> Self
[src]

Creates a Bits struct with the bits set to the booleans given

pub fn from_u8(num: u8) -> Self[src]

convert an u8 into a bits struct.

pub fn to_u8(&self) -> u8[src]

Converts the bits struct to a u8

Trait Implementations

impl PartialEq<Bits> for Bits[src]

impl Default for Bits[src]

impl Debug for Bits[src]

impl Serialize for Bits[src]

impl<'de> Deserialize<'de> for Bits[src]

Auto Trait Implementations

impl Unpin for Bits

impl Sync for Bits

impl Send for Bits

impl RefUnwindSafe for Bits

impl UnwindSafe for Bits

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]