Skip to main content

EstimateSize

Trait EstimateSize 

Source
pub trait EstimateSize {
    // Required method
    fn estimate_size(&self) -> usize;
}
Expand description

Trait for estimating the memory size of cached values.

Implement this trait for custom types to enable accurate memory tracking.

Required Methods§

Source

fn estimate_size(&self) -> usize

Estimate the memory size of this value in bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl EstimateSize for ()

Source§

impl EstimateSize for String

Source§

impl EstimateSize for [u8]

Source§

impl EstimateSize for str

Source§

impl<K, V> EstimateSize for HashMap<K, V>

Source§

impl<T, E> EstimateSize for Result<T, E>

Source§

impl<T> EstimateSize for &T
where T: EstimateSize + ?Sized,

Source§

impl<T> EstimateSize for Option<T>
where T: EstimateSize,

Source§

impl<T> EstimateSize for Vec<T>
where T: EstimateSize,

Implementors§