#[repr(transparent)]pub struct BitLength<T = usize>(T);
Expand description
The length of something, in bits.
This can represent a bit length that isn’t a whole number of bytes.
Tuple Fields§
§0: T
Implementations§
source§impl BitLength<usize>
impl BitLength<usize>
sourcepub const fn from_usize_bits(bits: usize) -> Self
pub const fn from_usize_bits(bits: usize) -> Self
Constructs a BitLength
from the given length in bits.
pub(crate) fn half_rounded_up(&self) -> Self
sourcepub fn as_usize_bytes_rounded_up(&self) -> usize
pub fn as_usize_bytes_rounded_up(&self) -> usize
The bit length, rounded up to a whole number of bytes.
pub(crate) fn try_sub_1(self) -> Result<Self, Unspecified>
Trait Implementations§
source§impl FromUsizeBytes for BitLength<usize>
impl FromUsizeBytes for BitLength<usize>
source§fn from_usize_bytes(bytes: usize) -> Result<Self, Unspecified>
fn from_usize_bytes(bytes: usize) -> Result<Self, Unspecified>
Constructs a
BitLength
from the given length in bytes. Read moresource§impl FromUsizeBytes for BitLength<u64>
impl FromUsizeBytes for BitLength<u64>
source§fn from_usize_bytes(bytes: usize) -> Result<Self, Unspecified>
fn from_usize_bytes(bytes: usize) -> Result<Self, Unspecified>
Constructs a
BitLength
from the given length in bytes. Read moresource§impl<T: PartialOrd> PartialOrd for BitLength<T>
impl<T: PartialOrd> PartialOrd for BitLength<T>
impl<T: Copy> Copy for BitLength<T>
impl<T: Eq> Eq for BitLength<T>
impl<T> StructuralPartialEq for BitLength<T>
Auto Trait Implementations§
impl<T> Freeze for BitLength<T>where
T: Freeze,
impl<T> RefUnwindSafe for BitLength<T>where
T: RefUnwindSafe,
impl<T> Send for BitLength<T>where
T: Send,
impl<T> Sync for BitLength<T>where
T: Sync,
impl<T> Unpin for BitLength<T>where
T: Unpin,
impl<T> UnwindSafe for BitLength<T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)