Trait bevy_datasize::DataSizeEstimator [−][src]
pub trait DataSizeEstimator<T: ?Sized> {
const IS_DYNAMIC: bool;
fn estimate_heap_size(&self, value: &T) -> usize;
}
Expand description
Indicates that a type can estimate the heap usage of values of type T
.
This trait exists in order to work around the fact that this crate cannot
add impls of DataSize
to types from the Bevy crate(s).
Associated Constants
const IS_DYNAMIC: bool
const IS_DYNAMIC: bool
If true
, the type T
has a heap size that can vary at runtime,
depending on the actual value.
Required methods
fn estimate_heap_size(&self, value: &T) -> usize
fn estimate_heap_size(&self, value: &T) -> usize
Estimates the size of heap memory taken up by the given value.
Does not include data on the stack, which is usually determined using
std::mem::size_of
.