Skip to main content

MemoryBounds

Trait MemoryBounds 

Source
pub trait MemoryBounds {
    // Required method
    fn specify_bounds(&self, builder: &mut MemoryBoundsBuilder<'_>);
}
Expand description

Memory bounds for a component.

Components will naturally allocate memory in many phases, from initialization to normal operation. In some cases, these allocations can be unbounded, leading to potential memory exhaustion.

When a component has a way to bound its memory usage, it can implement this trait to provide that accounting. A bounds builder exposes a simple interface for tallying up the memory usage of individual pieces of a component, such as buffers and buffer pools, containers, and more.

Required Methods§

Source

fn specify_bounds(&self, builder: &mut MemoryBoundsBuilder<'_>)

Specifies the minimum and firm memory bounds for this component and its subcomponents.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> MemoryBounds for &T
where T: MemoryBounds,

Source§

fn specify_bounds(&self, builder: &mut MemoryBoundsBuilder<'_>)

Source§

impl<T> MemoryBounds for Box<T>
where T: MemoryBounds + ?Sized,

Source§

fn specify_bounds(&self, builder: &mut MemoryBoundsBuilder<'_>)

Implementors§