Skip to main content

QuiescentRegion

Struct QuiescentRegion 

Source
pub struct QuiescentRegion { /* private fields */ }
Expand description

Quiescent, pre-transfer owner of a zero-initialized Mach mapping.

This is the only typestate that exposes ordinary byte slices. Consuming it chooses the one writer direction and permanently removes those accessors.

Implementations§

Source§

impl QuiescentRegion

Source

pub fn new(len: usize) -> Result<Self, MachError>

Allocates a non-executable, zero-initialized Mach VM region.

Examples found in repository?
examples/quiescent_region.rs (line 16)
15fn main() -> Result<(), Box<dyn std::error::Error>> {
16    let mut region = native_ipc_platform::macos::QuiescentRegion::new(256)?;
17    initialize(&mut region.as_bytes_mut()[..256]);
18    println!("Mach VM capability: {} page-rounded bytes", region.len());
19    Ok(())
20}
Source

pub const fn len(&self) -> usize

Returns the negotiated page-rounded capability length.

Examples found in repository?
examples/quiescent_region.rs (line 18)
15fn main() -> Result<(), Box<dyn std::error::Error>> {
16    let mut region = native_ipc_platform::macos::QuiescentRegion::new(256)?;
17    initialize(&mut region.as_bytes_mut()[..256]);
18    println!("Mach VM capability: {} page-rounded bytes", region.len());
19    Ok(())
20}
Source

pub const fn logical_len(&self) -> usize

Returns the requested logical layout length within the capability.

Source

pub const fn is_empty(&self) -> bool

Returns whether the logical region is empty (always false for a valid value).

Source

pub fn as_bytes(&self) -> &[u8]

Borrows quiescent initialization bytes.

Source

pub fn as_bytes_mut(&mut self) -> &mut [u8]

Mutably borrows quiescent initialization bytes.

Examples found in repository?
examples/quiescent_region.rs (line 17)
15fn main() -> Result<(), Box<dyn std::error::Error>> {
16    let mut region = native_ipc_platform::macos::QuiescentRegion::new(256)?;
17    initialize(&mut region.as_bytes_mut()[..256]);
18    println!("Mach VM capability: {} page-rounded bytes", region.len());
19    Ok(())
20}
Source

pub fn into_local_writer( self, expected_len: usize, ) -> Result<LocalWriterRegion, MachError>

Selects this process as sole writer and creates one read-only peer entry.

Source

pub fn into_remote_writer( self, expected_len: usize, ) -> Result<RemoteWriterRegion, MachError>

Selects the peer as sole writer and permanently downgrades this mapping.

Source

pub fn into_bound_local_writer( self, expected: ValidationExpectations, topology: RegionSetLayout, ) -> Result<WriterRegion<MacWriterMapping>, MacBindingError>

Validates the complete padded capability, then consumes it as the sole writer.

Source

pub fn into_bound_remote_writer( self, expected: ValidationExpectations, topology: RegionSetLayout, ) -> Result<ReaderRegion<MacReaderMapping>, MacBindingError>

Validates the complete padded capability, then downgrades it to read-only.

Source

pub fn transfer_local_writer( self, expected: ValidationExpectations, topology: RegionSetLayout, channel: &mut ParentChannel, ) -> Result<PendingTransferredWriter, MacBindingError>

Validates, transfers a read-only entry, and commits the local writer.

The returned pending value has no payload API. Pass it as part of the exact batch to bootstrap::ParentChannel::commit_transfers.

§Errors

Returns an error if layout validation, Mach permission attenuation, runtime binding, or authenticated capability transfer fails. Failure poisons the active parent transaction.

Source

pub fn transfer_remote_writer( self, expected: ValidationExpectations, topology: RegionSetLayout, channel: &mut ParentChannel, ) -> Result<PendingTransferredReader, MacBindingError>

Validates, transfers the sole writer entry, and commits local read-only access.

The local reader and peer writer remain pending until the batch commits.

§Errors

Returns an error if validation, permanent local protection downgrade, runtime binding, or authenticated capability transfer fails.

Trait Implementations§

Source§

impl Debug for QuiescentRegion

Source§

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

Formats the value using the given formatter. 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.

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.