Skip to main content

LayoutBuilder

Struct LayoutBuilder 

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

A builder for computing a deterministic VM address-space layout.

Implementations§

Source§

impl<'a> LayoutBuilder<'a>

Source

pub fn new() -> Self

Creates a new layout builder.

Source

pub fn reserve(&mut self, tag: impl Into<Arc<str>>, range: MemoryRange)

Reserves a range so no allocation can use it.

Reserved ranges are removed from the free list and may appear in the returned PlacedRange list, but they do not affect post-MMIO placement. Trailing reserved ranges are omitted from the returned list.

Source

pub fn fixed(&mut self, tag: impl Into<Arc<str>>, range: MemoryRange)

Adds a fixed range request to the builder.

Source

pub fn request( &mut self, tag: impl Into<Arc<str>>, target: &'a mut MemoryRange, size: u64, alignment: u64, placement: Placement, )

Adds a dynamic single-range request to the builder.

The target is filled in when Self::allocate succeeds.

Source

pub fn ram( &mut self, tag: impl Into<Arc<str>>, target: &'a mut Vec<MemoryRange>, size: u64, alignment: u64, )

Adds an ordinary RAM request to the builder.

RAM requests are placed in caller order. The first request is placed bottom up from GPA 0; each subsequent request starts at or above the highest address used by previous RAM requests, so later requests never backfill fragments skipped by earlier ones. A single request may still split around fixed and Mmio32 ranges encountered inside its own span; each extent starts at alignment, and split extents that do not satisfy the rest of the request are rounded down to alignment so large aligned requests are not fragmented into smaller chunks. The target vector is replaced with the placed RAM extents when Self::allocate succeeds.

Source

pub fn allocate(self) -> Result<Vec<PlacedRange>, AllocateError>

Allocates all requests, fills in each target, and returns every placed range sorted by address.

Trait Implementations§

Source§

impl Default for LayoutBuilder<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for LayoutBuilder<'a>

§

impl<'a> RefUnwindSafe for LayoutBuilder<'a>

§

impl<'a> Send for LayoutBuilder<'a>

§

impl<'a> Sync for LayoutBuilder<'a>

§

impl<'a> Unpin for LayoutBuilder<'a>

§

impl<'a> UnsafeUnpin for LayoutBuilder<'a>

§

impl<'a> !UnwindSafe for LayoutBuilder<'a>

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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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