pub struct ProcessSlot { /* private fields */ }Expand description
Represents a slot for a process in a ProcessArray.
A slot can be empty (None), or hold a reference to a
Process.
The ProcessSlot type is useful for allowing slices of processes without
knowing the fixed number of processes, or being templated on NUM_PROCS.
That is, interfaces can use [ProcessSlot] to just use an array of process
slots.
Implementations§
Source§impl ProcessSlot
impl ProcessSlot
Sourcepub fn set_external(
&self,
process: &'static dyn Process,
_capability: &dyn ExternalProcessCapability,
)
pub fn set_external( &self, process: &'static dyn Process, _capability: &dyn ExternalProcessCapability, )
Install a Process into this process slot from outside the
kernel crate.
The normal set() method is pub(crate) because, in
production, only the kernel’s own process-loading machinery should be
able to populate a process slot. However, test code and external process
implementations live in separate crates and still need a way to register
a process with the kernel.
set_external provides that path: it is public but requires the
caller to present an
ExternalProcessCapability.
This capability is an unsafe-to-implement marker trait, so only
explicitly trusted code (typically a test harness) can obtain it. The
capability prevents arbitrary crates from silently replacing a running
process.
Sourcepub fn get(&self) -> Option<&'static dyn Process>
pub fn get(&self) -> Option<&'static dyn Process>
Return the underlying process::Process if the slot contains a
process.
Sourcepub fn contains_process_with_id(&self, identifier: usize) -> bool
pub fn contains_process_with_id(&self, identifier: usize) -> bool
Check if the slot contains a process with a matching process ID.
Trait Implementations§
Source§impl Clone for ProcessSlot
impl Clone for ProcessSlot
Source§fn clone(&self) -> ProcessSlot
fn clone(&self) -> ProcessSlot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more