Skip to main content

LoadSession

Struct LoadSession 

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

Kernel-backed loader session used by the command entry API.

Implementations§

Source§

impl LoadSession

Source

pub fn run_loaded_boot(&mut self, boot: &CliBoot) -> Result<i32, CliError>

Loads a boot session and runs the selected loaded CLI entrypoint.

Source

pub fn run_loaded_handoff( &mut self, envelope: &CliEnvelope, ) -> Result<i32, CliError>

Runs the selected loaded CLI entrypoint for an already-loaded session.

Source§

impl LoadSession

Source

pub fn run_loaded_introspection( &mut self, boot: &CliBoot, ) -> Result<String, CliError>

Loads a boot session and returns list/inspect output for loader metadata.

Listing or inspecting loaded libraries does not require a boot codec. When the codec is unavailable, fall back to loading just the explicit --load sources so they can still be introspected. (load_boot resolves the boot codec first and returns before loading --load sources when that codec is unavailable, so an empty receipt set means the codec was the failure.)

Source§

impl LoadSession

Source

pub fn new() -> Self

Builds a loader session with an empty static host catalog.

Source

pub fn add_loader(&mut self, loader: impl LibLoader + 'static)

Adds a kernel loader to the session.

Source

pub fn add_catalog_source( &mut self, symbol: impl AsRef<str>, source: CatalogSource, )

Registers a catalog source for a library symbol.

Source

pub fn with_catalog_source( self, symbol: impl AsRef<str>, source: CatalogSource, ) -> Self

Registers a catalog source, builder-style.

Source

pub fn with_loader(self, loader: impl LibLoader + 'static) -> Self

Adds a kernel loader, builder-style.

Source

pub fn add_host_factory( &mut self, name: impl Into<String>, factory: impl Fn() -> Box<dyn Lib> + Send + Sync + 'static, )

Adds a host library factory to the static host catalog.

Source

pub fn with_host_factory( self, name: impl Into<String>, factory: impl Fn() -> Box<dyn Lib> + Send + Sync + 'static, ) -> Self

Adds a host library factory, builder-style.

Source

pub fn with_crates_io_resolver(self, resolver: CratesIoResolver) -> Self

Replaces the crates.io resolver used for crates.io: sources.

Source

pub fn with_context(self, configure: impl FnOnce(&mut Cx)) -> Self

Applies direct access to the session context, builder-style.

Hosts use this to install context-level runtime support while keeping concrete command behavior in loaded libraries.

Source

pub fn with_capability(self, capability: CapabilityName) -> Self

Grants a capability to the session’s kernel context, builder-style.

Loaders that require a capability (for example the native dynamic-library loader requires native_dynamic_load_capability()) only succeed when the host has granted it. This lets a composed sim build authorize the loaders it registers.

Source

pub fn add_default_verb_sources( &mut self, verb: impl Into<String>, sources: Vec<LibSourceSpec>, )

Registers sources used when verb is selected without explicit loads.

Source

pub fn with_default_verb_sources( self, verb: impl Into<String>, sources: Vec<LibSourceSpec>, ) -> Self

Registers sources used when verb is selected without explicit loads, builder-style.

Source

pub fn cx(&self) -> &Cx

Returns the active kernel context.

Source

pub fn receipts(&self) -> &[LoadReceipt]

Returns load receipts in boot order.

Source

pub fn load_boot(&mut self, boot: &CliBoot) -> Result<&[LoadReceipt], CliError>

Loads every requested library in the parsed boot controls.

Source

pub fn load_source( &mut self, source: &LibSourceSpec, ) -> Result<LoadReceipt, CliError>

Loads one source through the kernel loader and records a receipt.

Source

pub fn unload_receipt( &mut self, receipt: &LoadReceipt, ) -> Result<Vec<LibId>, CliError>

Unloads a receipt’s library through the kernel lifecycle path.

Trait Implementations§

Source§

impl Default for LoadSession

Source§

fn default() -> Self

Returns the “default value” for a type. 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.