pub struct ProcessOwner<K = ()>(/* private fields */);Expand description
The owner of a leaked Record allocation, freeing it on drop.
It must outlive the program’s coroutine, whose frames point into the allocation:
drive_owned holds it beside the coroutine and drops it afterwards, on every path.
Implementations§
Source§impl<K> ProcessOwner<K>
impl<K> ProcessOwner<K>
Sourcepub fn new(keep: K, state: HostState) -> Result<Self, Status>
pub fn new(keep: K, state: HostState) -> Result<Self, Status>
Move the state and keep into a new allocation, reporting allocator exhaustion
instead of aborting. Both are released if this fails.
Sourcepub fn from_startup(
keep: K,
arguments: Vec<String>,
standard_input: Option<File>,
standard_output: Option<File>,
standard_error: Option<File>,
) -> Result<Self, Status>
pub fn from_startup( keep: K, arguments: Vec<String>, standard_input: Option<File>, standard_output: Option<File>, standard_error: Option<File>, ) -> Result<Self, Status>
Build the host state from a program’s arguments and standard streams, then
ProcessOwner::new.
Sourcepub fn heap(&self) -> NonNull<Heap>
pub fn heap(&self) -> NonNull<Heap>
The heap of the process. It stays valid until self is dropped.
Sourcepub fn state(&self) -> NonNull<HostState>
pub fn state(&self) -> NonNull<HostState>
The host state of the process. It stays at this address until self is dropped.
Sourcepub unsafe fn entry(
&self,
entry: NativeEntry,
launch: Option<ProcessLaunch>,
) -> impl FnOnce() -> i32 + 'static + use<K>
pub unsafe fn entry( &self, entry: NativeEntry, launch: Option<ProcessLaunch>, ) -> impl FnOnce() -> i32 + 'static + use<K>
The coroutine entry of the program. It holds only pointers into the allocation and
the launch request, which the callee consumes before native code runs: the
arguments, the streams and the startup block stay in the host state, off the
coroutine stack, so a process that exits early abandons this frame without leaking
(see xila_process_exit).
Without a launch the program is started like a linked one with no process
capability: it gets none of the process services and cannot exit early.
§Safety
entry obeys the startup lifetime rules, fits on the coroutine stack, and returns
without unwinding. It stays callable until the owner is dropped. The returned closure
must be invoked at most once, and only inside a coroutine that is dropped before the
owner (see drive_owned).
Source§impl<K: 'static> ProcessOwner<K>
impl<K: 'static> ProcessOwner<K>
Sourcepub fn erase(self) -> AnyProcessOwner
pub fn erase(self) -> AnyProcessOwner
Erase the type of the keep-alive value. The drop behavior is unchanged.