pub trait EstimateSize {
// Required method
fn estimated_heap_size(&self) -> usize;
// Provided method
fn estimated_size(&self) -> usize
where Self: Sized { ... }
}Expand description
The trait for estimating the actual memory usage of a struct.
Used for cache eviction now.
Required Methods§
Sourcefn estimated_heap_size(&self) -> usize
fn estimated_heap_size(&self) -> usize
The estimated heap size of the current struct in bytes.
Provided Methods§
Sourcefn estimated_size(&self) -> usizewhere
Self: Sized,
fn estimated_size(&self) -> usizewhere
Self: Sized,
The estimated total size of the current struct in bytes, including the estimated_heap_size
and the size of Self.
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 Box<str>
impl EstimateSize for Box<str>
fn estimated_heap_size(&self) -> usize
Source§impl EstimateSize for Builder
impl EstimateSize for Builder
fn estimated_heap_size(&self) -> usize
Source§impl EstimateSize for Bytes
SAFETY: Bytes can store a pointer in some cases, that may cause the size
of a Bytes be calculated more than one and when memory stats is larger than the real value.
impl EstimateSize for Bytes
SAFETY: Bytes can store a pointer in some cases, that may cause the size
of a Bytes be calculated more than one and when memory stats is larger than the real value.