Struct L1Table

Source
pub(super) struct L1Table {
    cluster: Option<HostCluster>,
    data: Box<[L1Entry]>,
    cluster_bits: u32,
    modified: AtomicBool,
}
Expand description

L1 table.

Fields§

§cluster: Option<HostCluster>

First cluster in the image file.

§data: Box<[L1Entry]>

Table data.

§cluster_bits: u32

log2 of the cluster size.

§modified: AtomicBool

Whether this table has been modified since it was last written.

Implementations§

Source§

impl L1Table

Source

pub fn clone_and_grow( &self, at_least_index: usize, header: &Header, ) -> Result<Self>

Create a clone that covers at least at_least_index.

Source

pub fn in_bounds(&self, index: usize) -> bool

Check whether index is in bounds.

Source

pub fn enter_l2_table(&mut self, index: usize, l2: &L2Table) -> Result<()>

Enter the given L2 table into this L1 table.

Trait Implementations§

Source§

impl Debug for L1Table

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Table for L1Table

Source§

const MAX_ENTRIES: usize = 4_194_304usize

Maximum number of L1 table entries.

Limit taken from QEMU; if QEMU rejects this, we can, too.

Source§

const NAME: &'static str = "L1 table"

User-readable struct name.
Source§

type InternalEntry = L1Entry

Internal type for each table entry.
Source§

type Entry = L1Entry

Externally visible type for each table entry.
Source§

fn from_data(data: Box<[L1Entry]>, header: &Header) -> Self

Create a new table with the given contents
Source§

fn entries(&self) -> usize

Number of entries.
Source§

fn get_ref(&self, index: usize) -> Option<&L1Entry>

Get the given entry (as reference).
Source§

fn get(&self, index: usize) -> L1Entry

Get the given entry (copied).
Source§

fn get_cluster(&self) -> Option<HostCluster>

Get this table’s (first) cluster in the image file.
Source§

fn get_offset(&self) -> Option<HostOffset>

Get this table’s offset in the image file.
Source§

fn set_cluster(&mut self, cluster: HostCluster)

Set this table’s (first) cluster in the image file (for writing).
Source§

fn unset_cluster(&mut self)

Remove the table’s association with any cluster in the image file.
Source§

fn is_modified(&self) -> bool

Check whether this table has been modified since it was last written.
Source§

fn clear_modified(&self)

Clear the modified flag.
Source§

fn set_modified(&self)

Set the modified flag.
Source§

fn cluster_bits(&self) -> u32

Return log2 of the cluster size. Read more
Source§

fn byte_size(&self) -> usize

Table size in bytes.
Source§

fn cluster_count(&self) -> ClusterCount

Number of clusters used by this table.
Source§

async fn load<S: Storage>( image: &S, header: &Header, cluster: HostCluster, entries: usize, ) -> Result<Self>

Load a table from the image file.
Source§

async fn write<S: Storage>(&self, image: &S) -> Result<()>

Write a table to the image file. Read more
Source§

async fn write_entry<S: Storage>(&self, image: &S, index: usize) -> Result<()>

Write at least the given single (modified) entry to the image file. Read more

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.

§

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