Trait re_types_core::SizeBytes

source ·
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§

source

fn heap_size_bytes(&self) -> u64

Returns the total size of self on the heap, in bytes.

Provided Methods§

source

fn total_size_bytes(&self) -> u64

Returns the total size of self in bytes, accounting for both stack and heap space.

source

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).

source

fn is_pod() -> bool

Is Self just plain old data?

If true, this will make most blanket implementations of SizeBytes much faster (e.g. Vec<T>).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SizeBytes for DataType

source§

impl SizeBytes for bool

source§

impl SizeBytes for f32

source§

impl SizeBytes for f64

source§

impl SizeBytes for i8

source§

impl SizeBytes for i16

source§

impl SizeBytes for i32

source§

impl SizeBytes for i64

source§

impl SizeBytes for i128

source§

impl SizeBytes for u8

source§

impl SizeBytes for u16

source§

impl SizeBytes for u32

source§

impl SizeBytes for u64

source§

impl SizeBytes for u128

source§

impl SizeBytes for String

source§

fn heap_size_bytes(&self) -> u64

Does not take capacity into account.

source§

impl SizeBytes for Field

source§

impl SizeBytes for f16

source§

impl SizeBytes for Tuid

source§

impl SizeBytes for dyn Array

source§

impl<K: SizeBytes> SizeBytes for BTreeSet<K>

source§

impl<K: SizeBytes, V: SizeBytes> SizeBytes for BTreeMap<K, V>

source§

impl<K: SizeBytes, V: SizeBytes, S> SizeBytes for HashMap<K, V, S>

source§

impl<T, U> SizeBytes for (T, U)
where T: SizeBytes, U: SizeBytes,

source§

impl<T, U, V> SizeBytes for (T, U, V)
where T: SizeBytes, U: SizeBytes, V: SizeBytes,

source§

impl<T, U, V, W> SizeBytes for (T, U, V, W)
where T: SizeBytes, U: SizeBytes, V: SizeBytes, W: SizeBytes,

source§

impl<T: SizeBytes> SizeBytes for Option<T>

source§

impl<T: SizeBytes> SizeBytes for VecDeque<T>

source§

fn heap_size_bytes(&self) -> u64

Does not take capacity into account.

source§

impl<T: SizeBytes> SizeBytes for Arc<T>

source§

impl<T: SizeBytes> SizeBytes for Vec<T>

source§

fn heap_size_bytes(&self) -> u64

Does not take capacity into account.

source§

impl<T: SizeBytes, const N: usize> SizeBytes for [T; N]

source§

impl<T: SizeBytes, const N: usize> SizeBytes for SmallVec<[T; N]>

source§

fn heap_size_bytes(&self) -> u64

Does not take capacity into account.

Implementors§