Usage

Struct Usage 

Source
pub struct Usage {
    pub total: usize,
    pub used: usize,
    pub free: usize,
    pub objects: usize,
}
Expand description

Memory usage information.

This structure is returned by Teaspoon::usage. See that method documentation for information and examples.

Fields§

§total: usize

Total memory available to the allocator.

This includes memory that may be used by the allocator for both allocated objects and internal structures. total usually matches the size passed to the Teaspoon constructor, but sometimes may be slightly lower due to align requirements.

Note that total does not equal used + free. That’s because used does not keep into account the overhead from the internal structures used by the allocator. The expression total - used - free may be used to calculate this overhead.

§used: usize

Total memory used by allocated objects.

This is the sum of the usable data of each allocated object. It does not take into account the overhead from the internal structures used by the allocator.

§free: usize

Memory unused by the allocator.

This is the total memory available, minus all the allocated memory, minus all the memory used by internal structures. Note that trying to allocate an object of size equal to (or close to) free may not succeed, due to overheads and memory fragmentation.

§objects: usize

Number of objects currently allocated.

Allocating an object increments this number; deallocating an object decrements it; growing/shrinking an object does not alter this number.

Trait Implementations§

Source§

impl Clone for Usage

Source§

fn clone(&self) -> Usage

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Usage

Source§

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

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

impl Default for Usage

Source§

fn default() -> Usage

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

impl PartialEq for Usage

Source§

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

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

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 Eq for Usage

Source§

impl StructuralPartialEq for Usage

Auto Trait Implementations§

§

impl Freeze for Usage

§

impl RefUnwindSafe for Usage

§

impl Send for Usage

§

impl Sync for Usage

§

impl Unpin for Usage

§

impl UnwindSafe for Usage

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.