Skip to main content

Guest

Trait Guest 

Source
pub trait Guest {
    // Required methods
    fn astrid_hook_trigger(action: String, payload: Vec<u8>) -> CapsuleResult;
    fn run();
    fn astrid_install();
    fn astrid_upgrade();
}

Required Methods§

Source

fn astrid_hook_trigger(action: String, payload: Vec<u8>) -> CapsuleResult

── Guest exports ────────────────────────────────────────────── Execute an interceptor hook.

This is the primary entry point for hook/interceptor execution. The kernel passes the action name (interceptor handler to invoke) and the event payload as raw bytes. The guest returns a result directing the kernel how to proceed.

Source

fn run()

Background run loop for long-lived capsules.

Capsules that export run are started as background tasks. The function should block indefinitely (event loop pattern), processing IPC messages via subscriptions set up before calling signal-ready. The kernel manages the lifecycle.

Source

fn astrid_install()

Lifecycle hook: first-time installation.

Called once when a capsule is installed. May use elicit to collect secrets and configuration from the user interactively. Optional — capsules without this export skip the install phase.

Source

fn astrid_upgrade()

Lifecycle hook: upgrade from a previous version.

Called when a capsule is upgraded. May use elicit to collect new configuration. Optional — capsules without this export skip the upgrade phase.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§