[−][src]Struct ptero::binary::BitVec
Wrapper for Vec<Bit> used for implementing From trait.
Implementations
impl BitVec[src]
pub fn filled_with(bit_val: u8, length: usize) -> BitVec[src]
Constructs a BitVec of given length filled with bit_val.
Arguments
bit_val- value that will be set to the Bitlength- length of the output vector
Examples
Create a BitVec filled with 8 zero bits
use ptero::binary::{Bit, BitVec}; let vec: Vec<Bit> = BitVec::filled_with(0, 8).into(); assert_eq!(vec, &[Bit(0), Bit(0), Bit(0), Bit(0), Bit(0), Bit(0), Bit(0), Bit(0)]);
Trait Implementations
impl Debug for BitVec[src]
impl From<Vec<Bit, Global>> for BitVec[src]
impl From<u32> for BitVec[src]
pub fn from(number: u32) -> Self[src]
Conversion implementation for u32.
Converts u32 number to the vector of Bits.
The result vector has the most significant bit at the beginning.
Examples
Convert the 65 number
use ptero::binary::{Bit, BitVec}; let array: BitVec = vec![1, 0, 1, 1, 1] .iter() .map(|v| Bit(*v)) .collect::<Vec<Bit>>() .into(); let number: u32 = array.into(); assert_eq!(number, 23);
Auto Trait Implementations
impl RefUnwindSafe for BitVec[src]
impl Send for BitVec[src]
impl Sync for BitVec[src]
impl Unpin for BitVec[src]
impl UnwindSafe for BitVec[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,