pub trait ByteSize {
// Required method
fn allocated_size(&self) -> usize;
}
Expand description
Returns the allocated memory in bytes.
Required Methods§
sourcefn allocated_size(&self) -> usize
fn allocated_size(&self) -> usize
Returns the amount of allocated memory in bytes.
Note that most probably this is an approximation and not the exact byte value. However, it should represent the “largest” part of an instance. (E.g. for a string, this would be the bytes allocated on the heap and might discard the fields allocated on the stack used to store the length and capacity as well as the pointer itself.