pub enum BitPad {
Ones,
Zeros,
}Expand description
Represents a method that can be used for padding a BitField
Variants§
Implementations§
Source§impl BitPad
impl BitPad
Sourcepub fn bit_field(&self, length: BitIndex) -> BitField
pub fn bit_field(&self, length: BitIndex) -> BitField
Generates a BitField of the specified length using the padding method
specified by self.
§Panics
Panics if length is negative
§Examples
use bitutils2::{BitField, BitIndex, bx, BitPad};
let bf = BitPad::Zeros.bit_field(bx!(2, 4));
assert_eq!(bf, BitField::from_hex_str("00 00 0"));
let bf = BitPad::Ones.bit_field(bx!(2, 4));
assert_eq!(bf, BitField::from_hex_str("ff ff f"));Auto Trait Implementations§
impl Freeze for BitPad
impl RefUnwindSafe for BitPad
impl Send for BitPad
impl Sync for BitPad
impl Unpin for BitPad
impl UnwindSafe for BitPad
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