Struct webc::WebC

source · []
pub struct WebC<'data> {
    pub version: u64,
    pub checksum: Option<Checksum>,
    pub signature: Option<Signature>,
    pub manifest: Manifest,
    pub atoms: Volume<'data>,
    pub volumes: IndexMap<String, Volume<'data>>,
}
Expand description

Container file, lazily parsed from a set of &'data [u8] bytes

Fields

version: u64

Version of the file format

checksum: Option<Checksum>

Parsed checksum (optional in case of no encoded checksum)

signature: Option<Signature>

Parsed signature (optional if file was not signed)

manifest: Manifest

Manifest of the file, see section §2.3.1 of the spec

atoms: Volume<'data>

Executable files, indexed into one volume (a.wasm => a, b.wasm => b@0.2.1)

volumes: IndexMap<String, Volume<'data>>

Filesystem volumes: default volume name is atom (containing files of the current package) and user/package@version for external dependencies. Every dependency can be sandboxed to only access its own filesystem volume, not external ones.

Implementations

Packs a directory into a volume file

Checks whether the file starts with the header MAGIC

Determines the available volumes for a given package

Returns the directory entries or an error if the directory does not exist

source

pub fn get_file_entry(
    &self,
    package: &str,
    path: &str
) -> Option<(String, OwnedFsEntryFile)>

Looks for the first volume containing “entry”, scoped to the given package

Checks whether the version of the file is supported by the parsing implementation

Returns the bytes of the checksum

Returns the offset of the manifest start

Returns the offset of the .atoms section of the file

Parses the .atoms section of the file

Returns the offsets of the “volume”

Parses the .volumes section(s) of the file

Computes the checksum of the file without cloning it

Returns the offset of the signature

Read the signature bytes

Returns the (unverified) signature from the file

Returns a reference to the manifest

Returns the current package name with

Returns an atom by name for a given package

Returns a reference to the filesystem volume of the package

Returns a file for a given package - if you want to use a non-default volume, prefix the file_path with volume://, for example, metadata://README.md

Returns a list of volumes for this package

Returns a list of bundled “package@version” strings contained in this package

Returns the atoms in the root package

Returns a list of all atoms with bytes

List the atoms for a given package

List the available commands for the root package

Parses the entire file, depending on the ParseOptions

Serialize the .webc file into bytes

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.