#[non_exhaustive]pub struct DelegateManifest {
pub manifest_version: u16,
pub lifecycle: Vec<LifecycleKind>,
pub capabilities: Vec<Capability>,
}Expand description
What a delegate declares it wants from the node.
#[non_exhaustive] so fields can be added without a source break; build one
with DelegateManifest::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.manifest_version: u16Format version; see MANIFEST_VERSION.
lifecycle: Vec<LifecycleKind>Lifecycle events the delegate wants delivered. The node never sends a
LifecycleEvent of a kind that is not listed here.
capabilities: Vec<Capability>Node-enforced capabilities the delegate asks the user for.
Implementations§
Source§impl DelegateManifest
impl DelegateManifest
Sourcepub fn new(lifecycle: Vec<LifecycleKind>, capabilities: Vec<Capability>) -> Self
pub fn new(lifecycle: Vec<LifecycleKind>, capabilities: Vec<Capability>) -> Self
A manifest at the current MANIFEST_VERSION.
Sourcepub fn wants_lifecycle(&self, kind: LifecycleKind) -> bool
pub fn wants_lifecycle(&self, kind: LifecycleKind) -> bool
Whether the manifest asks for lifecycle events of this kind.
Sourcepub fn wants_capability(&self, cap: Capability) -> bool
pub fn wants_capability(&self, cap: Capability) -> bool
Whether the manifest asks for this capability.
Sourcepub fn known_capabilities(&self) -> Vec<Capability>
pub fn known_capabilities(&self) -> Vec<Capability>
Known capabilities this manifest asks for, deduplicated, in declaration order. Unknown names are dropped.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ManifestError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ManifestError>
Parse a section payload.
Tolerant of manifests written by newer stdlibs: unknown fields are
ignored, a list field that is not an array (null, or any other shape)
reads as empty, and a list entry that is not a
name this reader knows (an unknown name, or a non-string value) reads as
Unknown rather than failing the manifest, so the known entries next
to it still count.
Sourcepub fn from_wasm(module: &[u8]) -> Result<Option<Self>, ManifestError>
pub fn from_wasm(module: &[u8]) -> Result<Option<Self>, ManifestError>
Read the manifest from a raw WASM module (no version prefix).
Ok(None) means the module has no manifest section: a delegate that
asked for nothing, which is every delegate built before manifests
existed. Only the section headers are walked; nothing is executed or
validated beyond what locating the section needs.