Struct Bw64

Source
pub struct Bw64(/* private fields */);
Expand description

A Bigwise type composed of 64 bits.

Wraps a u64

Trait Implementations§

Source§

impl Bigwise for Bw64

Source§

fn size() -> u32

Number of bits stored.
Source§

fn empty() -> Self

A value with all bits set to 0.
Source§

fn full() -> Self

A value with all bits set to 1.
Source§

fn from_bytes(bytes: &[u8]) -> Self

Creates a value based on raw data. Read more
Source§

fn to_bytes(self) -> Vec<u8>

The content of the value as raw bytes. Read more
Source§

fn get(self, i: u32) -> bool

The boolean value of the given bit. Read more
Source§

fn set(&mut self, i: u32, v: bool)

Assigns a boolean value to a given bit. Read more
Source§

fn rotate_left(self, n: u32) -> Self

Rotates all the bits n positions to the left. Read more
Source§

fn rotate_right(self, n: u32) -> Self

Rotates all the bits n positions to the right. Read more
Source§

impl BitAnd for Bw64

Source§

type Output = Bw64

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
Source§

impl BitOr for Bw64

Source§

type Output = Bw64

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl BitXor for Bw64

Source§

type Output = Bw64

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
Source§

impl Clone for Bw64

Source§

fn clone(&self) -> Bw64

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bw64

The sequence of zeroes and ones, the MSB (most significant bit) appearing on the left.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Bw64

Source§

fn default() -> Bw64

Returns the “default value” for a type. Read more
Source§

impl Hash for Bw64

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoIterator for Bw64

An iterator over the bits.

Bits are iterated from the least significant one to the most significant one.

§Examples

use bigwise::{Bigwise, Bw64};
let b = Bw64::from_bytes(&[0b11111000]);
let mut it = b.into_iter();
assert_eq!(Some(false), it.next());
assert_eq!(Some(false), it.next());
assert_eq!(Some(false), it.next());
assert_eq!(Some(true), it.next());
assert_eq!(Some(true), it.next());
assert_eq!(Some(true), it.next());
assert_eq!(Some(true), it.next());
assert_eq!(Some(true), it.next());
assert_eq!(Some(false), it.next());
assert_eq!(Some(false), it.next());
assert!(it.take(200).all(|v| v == false));
Source§

type Item = bool

The type of the elements being iterated over.
Source§

type IntoIter = BitsIter<Bw64>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Not for Bw64

Source§

type Output = Bw64

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl Ord for Bw64

Source§

fn cmp(&self, other: &Bw64) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Bw64

Source§

fn eq(&self, other: &Bw64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Bw64

Source§

fn partial_cmp(&self, other: &Bw64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rand for Bw64

Source§

fn rand<R: Rng>(rng: &mut R) -> Self

Generates a random instance of this type using the specified source of randomness.
Source§

impl Shl<u32> for Bw64

Source§

type Output = Bw64

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self

Performs the << operation. Read more
Source§

impl Shr<u32> for Bw64

Source§

type Output = Bw64

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self

Performs the >> operation. Read more
Source§

impl Copy for Bw64

Source§

impl Eq for Bw64

Source§

impl StructuralPartialEq for Bw64

Auto Trait Implementations§

§

impl Freeze for Bw64

§

impl RefUnwindSafe for Bw64

§

impl Send for Bw64

§

impl Sync for Bw64

§

impl Unpin for Bw64

§

impl UnwindSafe for Bw64

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.