MemoryBoundsBuilder

Struct MemoryBoundsBuilder 

Source
pub struct MemoryBoundsBuilder<'a> { /* private fields */ }
Expand description

Builder for defining the memory bounds of a component and its subcomponents.

This builder provides a simple interface for defining the minimum and firm bounds of a component, as well as declaring subcomponents. For example, a topology can contain its own “self” memory bounds, and then define the individual bounds for each component in the topology.

Implementations§

Source§

impl MemoryBoundsBuilder<'_>

Source

pub fn reset(&mut self)

Resets the bounds of the current component to a default state.

This can be used in scenarios where the bounds of a component need to be redefined after they have been specified, as not all components are able to be defined in a single pass.

Source

pub fn minimum(&mut self) -> BoundsBuilder<'_, Minimum>

Gets a builder object for defining the minimum bounds of the current component.

Source

pub fn firm(&mut self) -> BoundsBuilder<'_, Firm>

Gets a builder object for defining the firm bounds of the current component.

The firm limit is additive with the minimum required memory, so entries that are added via minimum do not need to be added again here.

Source

pub fn subcomponent<S>(&mut self, name: S) -> MemoryBoundsBuilder<'_>
where S: AsRef<str>,

Creates a nested subcomponent and gets a builder object for it.

This allows for defining the bounds of various subcomponents within a larger component, which are then rolled up into the calculated bounds for the parent component.

Source

pub fn with_subcomponent<S, C>(&mut self, name: S, component: &C) -> &mut Self
where S: AsRef<str>, C: MemoryBounds,

Creates a nested subcomponent based on the given component.

This allows for defining a subcomponent whose bounds come from an object that implements MemoryBounds directly.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Track for T

Source§

fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>

Instruments this type by attaching the given allocation group token, returning a Tracked wrapper. Read more
Source§

fn in_current_allocation_group(self) -> Tracked<Self>

Instruments this type by attaching the current allocation group, returning a Tracked wrapper. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more