Struct size_of::Context

source ·
pub struct Context { /* private fields */ }
Expand description

The context of a size query, used to keep track of shared pointers and the aggregated totals of seen data

Implementations

Creates a new, empty context

Returns true if the current context is shared

Run the given closure and mark all added allocations as shared

Adds one distinct allocation to the current context

Adds allocations distinct allocations to the current context

Adds size to the total bytes

  • Adds size to the shared bytes if the context is currently shared

Adds size shared bytes

Adds size to the total and excess bytes

  • Adds size to the shared bytes if the context is currently shared

Adds a vector-like object to the current context.

  • Adds len * element_size to the total bytes
  • Adds len * element_size to the shared bytes if the context is currently shared

Adds a vector-like object to the current context.

  • Adds capacity * element_size to the total bytes
  • Adds (capacity - len) * element_size to the excess bytes
  • Adds capacity * element_size to the shared bytes if the context is currently shared

Returns true and adds the given pointer to the current context if it hasn’t seen it yet. Returns false if the current context has seen the pointer before

Adds the given pointer to the current context regardless of whether it’s seen it yet

Returns true if the context has seen the given pointer

Returns the total size of all objects the current context has seen

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Gets the size of all “children” owned by this value, not including the size of the value itself. Read more
Gets the total size of the current value
Adds the size of the current value to the given Context, including both the size of the value itself and all of its children Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.