Trait vector::sinks::prelude::ByteSizeOf
source · pub trait ByteSizeOf {
// Required method
fn allocated_bytes(&self) -> usize;
// Provided method
fn size_of(&self) -> usize { ... }
}
Required Methods§
sourcefn allocated_bytes(&self) -> usize
fn allocated_bytes(&self) -> usize
Returns the allocated bytes of this type
This function returns the total number of bytes that have been allocated
interior to this type instance. It does not include any bytes that are
captured by std::mem::size_of
except for any bytes that are interior
to this type. For instance, BTreeMap<String, Vec<u8>>
would count all
bytes for String
and Vec<u8>
instances but not the exterior bytes
for BTreeMap
.
Provided Methods§
sourcefn size_of(&self) -> usize
fn size_of(&self) -> usize
Returns the in-memory size of this type
This function returns the total number of bytes that
std::mem::size_of
does in addition to any interior allocated
bytes. Its default implementation is std::mem::size_of
+
ByteSizeOf::allocated_bytes
.