pub trait SizeBytes {
// Required method
fn heap_size_bytes(&self) -> u64;
// Provided methods
fn total_size_bytes(&self) -> u64 { ... }
fn stack_size_bytes(&self) -> u64 { ... }
fn is_pod() -> bool { ... }
}
Expand description
Approximations of stack and heap size for both internal and external types.
Motly used for statistics and triggering events such as garbage collection.
Required Methods§
Sourcefn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
Returns how many bytes self
uses on the heap.
In some cases self
may be just a slice of a larger buffer.
This will in that case only return the memory used by that smaller slice.
If we however are the sole owner of the memory (e.g. a Vec
), then we return
the heap size of all children plus the capacity of the buffer.
Provided Methods§
Sourcefn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
Returns the total size of self
in bytes, accounting for both stack and heap space.
Sourcefn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
Returns the total size of self
on the stack, in bytes.
Defaults to std::mem::size_of_val(self)
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl SizeBytes for CrateVersion
impl SizeBytes for CrateVersion
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for ApplicationId
impl SizeBytes for ApplicationId
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for DataframePart
impl SizeBytes for DataframePart
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for BlueprintActivationCommand
impl SizeBytes for BlueprintActivationCommand
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for SetStoreInfo
impl SizeBytes for SetStoreInfo
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for StoreSource
impl SizeBytes for StoreSource
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for StoreSourceExtra
impl SizeBytes for StoreSourceExtra
fn heap_size_bytes(&self) -> u64
Source§impl SizeBytes for StoreVersion
impl SizeBytes for StoreVersion
fn heap_size_bytes(&self) -> u64
Source§impl<T, U, V, W> SizeBytes for (T, U, V, W)
impl<T, U, V, W> SizeBytes for (T, U, V, W)
Source§impl<T, const N: usize> SizeBytes for [T; N]where
T: SizeBytes,
impl<T, const N: usize> SizeBytes for [T; N]where
T: SizeBytes,
fn heap_size_bytes(&self) -> u64
Source§impl<T, const N: usize> SizeBytes for SmallVec<[T; N]>where
T: SizeBytes,
impl<T, const N: usize> SizeBytes for SmallVec<[T; N]>where
T: SizeBytes,
Source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
Does not take capacity into account.