Trait re_byte_size::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 how many bytes self uses on the heap.

In some cases self may be just a slice of a larger buffer. This will in that case only return the memory used by that smaller slice.

If we however are the sole owner of the memory (e.g. a Vec), then we return the heap size of all children plus the capacity of the buffer.

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

impl SizeBytes for f16

source§

impl SizeBytes for ArrayRef

source§

impl SizeBytes for DataType

source§

impl SizeBytes for Field

source§

impl SizeBytes for Fields

source§

impl SizeBytes for ListArray

source§

impl SizeBytes for RecordBatch

source§

impl SizeBytes for Schema

source§

impl SizeBytes for UnionFields

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 Box<T>

source§

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

source§

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

source§

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

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.

source§

impl<T: Array> SizeBytes for &T

source§

impl<T: ArrowNativeType> SizeBytes for ScalarBuffer<T>

Implementors§