pub trait NumEntries {
const CONST_NUM_ENTRIES: Option<usize>;
// Required methods
fn num_entries_shallow(&self) -> usize;
fn num_entries_deep(&self) -> usize;
}Expand description
Trait to report object size as the number of entries.
Required Associated Constants§
Sourceconst CONST_NUM_ENTRIES: Option<usize>
const CONST_NUM_ENTRIES: Option<usize>
Returns Some(n) if Self has constant size or None otherwise.
Required Methods§
Sourcefn num_entries_shallow(&self) -> usize
fn num_entries_shallow(&self) -> usize
Returns the number of entries in self.
Sourcefn num_entries_deep(&self) -> usize
fn num_entries_deep(&self) -> usize
Recursively computes the number of entries in a container by
calling this method on each entry in self.
Scalars have size 1. Container (e.g., vector, map) size is the sum of sizes of its elements. If elements have constant size, container size can be efficiently measured by multiplying the number of elements by the size of each element.
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.