Skip to main content

Bundle

Struct Bundle 

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

An opened, fully verified bundle held in memory.

Implementations§

Source§

impl Bundle

Source

pub fn open(bytes: &[u8], options: &OpenOptions) -> Result<Self, BundleError>

Open a bundle from archive bytes: enforce archive limits, check every file against its SHA-256, reject unlisted files, and verify the signature.

Source

pub fn open_path( path: impl AsRef<Path>, options: &OpenOptions, ) -> Result<Self, BundleError>

Read and open a bundle file.

Source

pub fn manifest(&self) -> &BundleManifest

Source

pub fn manifest_bytes(&self) -> &[u8] ⓘ

Exact manifest bytes (what signatures cover).

Source

pub fn signer(&self) -> Option<&str>

Hex public key of the verified signer, if the bundle is signed.

Source

pub fn file(&self, path: &str) -> Option<&[u8]>

Content of one file.

Source

pub fn paths(&self) -> impl Iterator<Item = &str>

Paths of every file (excluding manifest and signature).

Source

pub fn workflow_text(&self, name: Option<&str>) -> Result<&str, BundleError>

Source text of a workflow (None = the entry workflow).

Source

pub fn workflow(&self, name: Option<&str>) -> Result<Workflow, BundleError>

Parse a workflow (None = the entry workflow). name may be the stored path or its file stem (support for workflows/support.yaml).

Source

pub fn plugins(&self) -> Result<Vec<BundledPlugin>, BundleError>

Every plugin shipped under plugins/<name>/.

Source

pub fn wasm_plugins(&self) -> Result<Vec<BundledPlugin>, BundleError>

WebAssembly plugins only (portable to every host, including phones).

Source

pub fn knowledge_config(&self) -> Option<(&str, &str)>

Path and text of the knowledge-base config (knowledge/knowledge.{yaml,yml,json}).

Source

pub fn providers_config(&self) -> Option<(&str, &str)>

Path and text of the providers file (providers.{yaml,yml,json}), which never holds secrets.

Source

pub fn knowledge_config_at( &self, extracted: &Path, ) -> Option<Result<Value, BundleError>>

The knowledge-base config as JSON with every store path inside knowledge/ rewritten to its location under extracted (the directory passed to Bundle::extract_to). None when the bundle has no knowledge config.

Source

pub fn extract_to(&self, dir: &Path) -> Result<(), BundleError>

Write every file under dir (created if needed), preserving the layout. Paths were validated on open, so nothing escapes dir.

Source

pub fn check(&self, registry: &Registry) -> CompatReport

Compare the bundle’s requirements with a host registry (after bundled plugins were registered) and this runtime’s version.

Source§

impl Bundle

Source

pub fn register_wasm_plugins( &self, registry: &mut Registry, limits: &WasmLimits, ) -> Result<Vec<String>, BundleError>

Load every bundled WebAssembly plugin and register its node kinds in registry. Returns the registered kinds.

Kinds must start with <plugin name>., unless the plugin manifest sets allow_unprefixed_kinds (then only plain names without . are allowed). Kinds that already exist in registry are never replaced: a plugin whose kinds are all registered already (e.g. the same plugin installed on the host) is skipped, and a partial overlap is an error. Bundled plugins never receive plaintext secrets: that requires host-side trust. Non-WebAssembly plugins are ignored here; see Bundle::check.

Trait Implementations§

Source§

impl Clone for Bundle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bundle

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Bundle

§

impl Freeze for Bundle

§

impl Move for Bundle

§

impl RefUnwindSafe for Bundle

§

impl Send for Bundle

§

impl Sync for Bundle

§

impl Unpin for Bundle

§

impl UnsafeUnpin for Bundle

§

impl UnwindSafe for Bundle

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.