BytesCount

Struct BytesCount 

Source
pub struct BytesCount { /* private fields */ }
Expand description

Process N bytes.

Implementations§

Source§

impl BytesCount

Source

pub fn new<N: CountUInt>(count: N) -> Self

Count N bytes.

Source

pub const fn of<T>() -> Self

Counts the size of a type with size_of.

Source

pub const fn of_many<T>(n: usize) -> Self

Counts the size of multiple instances of a type with size_of.

Source

pub fn of_val<T: ?Sized>(val: &T) -> Self

Counts the size of a value with size_of_val.

Source

pub fn of_iter<T, I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Counts the bytes of Iterator::Items.

Source

pub fn of_str<S: ?Sized + AsRef<str>>(s: &S) -> Self

Counts the bytes of a &str.

This is like BytesCount::of_val with the convenience of behaving as expected for &String and other types that convert to &str.

Source

pub fn of_slice<T, S: ?Sized + AsRef<[T]>>(s: &S) -> Self

Counts the bytes of a slice.

This is like BytesCount::of_val with the convenience of behaving as expected for &Vec<T> and other types that convert to &[T].

Source§

impl BytesCount

Count bytes of multiple values.

Source

pub const fn f32(n: usize) -> Self

Counts the bytes of multiple f32s.

Source

pub const fn f64(n: usize) -> Self

Counts the bytes of multiple f64s.

Source

pub const fn i8(n: usize) -> Self

Counts the bytes of multiple i8s.

Source

pub const fn u8(n: usize) -> Self

Counts the bytes of multiple u8s.

Source

pub const fn i16(n: usize) -> Self

Counts the bytes of multiple i16s.

Source

pub const fn u16(n: usize) -> Self

Counts the bytes of multiple u16s.

Source

pub const fn i32(n: usize) -> Self

Counts the bytes of multiple i32s.

Source

pub const fn u32(n: usize) -> Self

Counts the bytes of multiple u32s.

Source

pub const fn i64(n: usize) -> Self

Counts the bytes of multiple i64s.

Source

pub const fn u64(n: usize) -> Self

Counts the bytes of multiple u64s.

Source

pub const fn i128(n: usize) -> Self

Counts the bytes of multiple i128s.

Source

pub const fn u128(n: usize) -> Self

Counts the bytes of multiple u128s.

Source

pub const fn isize(n: usize) -> Self

Counts the bytes of multiple isizes.

Source

pub const fn usize(n: usize) -> Self

Counts the bytes of multiple usizes.

Trait Implementations§

Source§

impl Clone for BytesCount

Source§

fn clone(&self) -> BytesCount

Returns a duplicate 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 BytesCount

Source§

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

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

impl<C: AsCountUInt> From<C> for BytesCount

Source§

fn from(count: C) -> Self

Converts to this type from the input type.
Source§

impl Ord for BytesCount

Source§

fn cmp(&self, other: &BytesCount) -> 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 BytesCount

Source§

fn eq(&self, other: &BytesCount) -> 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 BytesCount

Source§

fn partial_cmp(&self, other: &BytesCount) -> 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 Copy for BytesCount

Source§

impl Counter for BytesCount

Source§

impl Eq for BytesCount

Source§

impl StructuralPartialEq for BytesCount

Auto Trait Implementations§

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<C> IntoCounter for C
where C: Counter,

Source§

type Counter = C

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

fn into_counter(self) -> <C as IntoCounter>::Counter

Converts into a Counter.
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.