[][src]Struct ppatch::MaskedByte

pub struct MaskedByte<T> { /* fields omitted */ }

Methods

impl<T> MaskedByte<T> where
    T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>, 
[src]

pub fn new(value: T, mask: T) -> Self[src]

Returns new MaskedByte

pub fn matches(&self, data: T) -> bool[src]

Matches data against MaskedByte. Where mask bit is 1 the bit of value has to fit data, mask bit 0 means data bit can be anything. Returns true if masked bits match.

pub fn set(&self, data: T) -> T[src]

Sets data bits to value bits where masked bits are 1

pub fn defined(&self) -> Option<T>[src]

Returns value if mask is fully defined

Trait Implementations

impl<T> Default for MaskedByte<T> where
    T: Default
[src]

impl<T: PartialEq> PartialEq<MaskedByte<T>> for MaskedByte<T>[src]

impl<T> Display for MaskedByte<T> where
    T: PrimInt + ShrAssign<u8>, 
[src]

impl<T> Debug for MaskedByte<T> where
    T: Binary + PrimInt
[src]

impl<T> FromStr for MaskedByte<T> where
    T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>, 
[src]

type Err = Error

The associated error which can be returned from parsing.

fn from_str(string: &str) -> Result<Self, Self::Err>[src]

Creates MaskedByte from string representation. String needs to be preceded with a base prefix. Allowed are "0b" for binary, "0x" for hexadecimal and "0o" for octal number representation. The "?" char stands for undefined bits. Examples: 0x?5 equals 0b????0101 which represents a value of 0b00000101 with a mask of 0b00001111.

impl<T> StructuralPartialEq for MaskedByte<T>[src]

Auto Trait Implementations

impl<T> Send for MaskedByte<T> where
    T: Send

impl<T> Sync for MaskedByte<T> where
    T: Sync

impl<T> Unpin for MaskedByte<T> where
    T: Unpin

impl<T> UnwindSafe for MaskedByte<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for MaskedByte<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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]