Trait dyn_size_of::GetSize

source ·
pub trait GetSize {
    const USES_DYN_MEM: bool = false;

    fn size_bytes_dyn(&self) -> usize { ... }
    fn size_bytes_content_dyn(&self) -> usize { ... }
    fn size_bytes(&self) -> usize { ... }
}
Expand description

Provides methods to get dynamic and total size of the variable.

Provided Associated Constants§

true if and only if the variables of this type can use dynamic (heap) memory.

Provided Methods§

Returns approximate number of bytes occupied by dynamic (heap) part of self. Same as self.size_bytes() - std::mem::size_of_val(self).

Returns approximate number of bytes occupied by dynamic (heap) part of self content. It usually equals to size_bytes_dyn(). However, sometimes it is smaller by the amount of memory reserved but not yet used (e.g., size_bytes_content_dyn() only takes into account the length of the vector and not its capacity).

Returns approximate, total (including heap memory) number of bytes occupied by self.

Implementations on Foreign Types§

Implementors§