[−][src]Struct ppatch::MaskedByte
Methods
impl<T> MaskedByte<T> where
T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>,
[src]
T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>,
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]
T: Default,
impl<T: PartialEq> PartialEq<MaskedByte<T>> for MaskedByte<T>
[src]
fn eq(&self, other: &MaskedByte<T>) -> bool
[src]
fn ne(&self, other: &MaskedByte<T>) -> bool
[src]
impl<T> Display for MaskedByte<T> where
T: PrimInt + ShrAssign<u8>,
[src]
T: PrimInt + ShrAssign<u8>,
impl<T> Debug for MaskedByte<T> where
T: Binary + PrimInt,
[src]
T: Binary + PrimInt,
impl<T> FromStr for MaskedByte<T> where
T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>,
[src]
T: From<u8> + ShlAssign<u32> + BitOrAssign + BitAndAssign + PartialEq + PrimInt + Unsigned + Default + PrimInt<FromStrRadixErr = ParseIntError>,
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,
T: Send,
impl<T> Sync for MaskedByte<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MaskedByte<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MaskedByte<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for MaskedByte<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,