Struct mr_bundle::Bundle [−][src]
pub struct Bundle<M> where
M: Manifest, { /* fields omitted */ }
Expand description
A Manifest bundled together, optionally, with the Resources that it describes. This is meant to be serialized for standalone distribution, and deserialized by the receiver.
The manifest may describe locations of resources not included in the Bundle.
Implementations
pub fn new<R: IntoIterator<Item = (PathBuf, ResourceBytes)>>(
manifest: M,
resources: R,
root_dir: PathBuf
) -> MrBundleResult<Self>
pub fn new<R: IntoIterator<Item = (PathBuf, ResourceBytes)>>(
manifest: M,
resources: R,
root_dir: PathBuf
) -> MrBundleResult<Self>
Creates a bundle containing a manifest and a collection of resources to be bundled together with the manifest.
The paths paired with each resource must correspond to the set of
Location::Bundle
s specified in the Manifest::location()
, or else
this is not a valid bundle.
A base directory must also be supplied so that relative paths can be resolved into absolute ones.
pub fn new_unchecked<R: IntoIterator<Item = (PathBuf, ResourceBytes)>>(
manifest: M,
resources: R
) -> MrBundleResult<Self>
pub fn new_unchecked<R: IntoIterator<Item = (PathBuf, ResourceBytes)>>(
manifest: M,
resources: R
) -> MrBundleResult<Self>
Create a bundle, asserting that all paths in the Manifest are absolute.
Return a new Bundle with an updated manifest, subject to the same validation constraints as creating a new Bundle from scratch.
Load a Bundle into memory from a file
Write a Bundle to a file
Retrieve the bytes for a resource at a Location, downloading it if necessary
Return the full set of resources specified by this bundle’s manifest. References to bundled resources can be returned directly, while all others will be fetched from the filesystem or the network.
Resolve all resources, but with fully owned references
Access the map of resources included in this bundle
Bundled resources are also accessible via resolve
or resolve_all
,
but using this method prevents a Clone
An arbitrary and opaque encoding of the bundle data into a byte array
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more