pub struct DnaBundle(_);
Expand description
A bundle of Wasm zomes, respresented as a file.
Implementations§
source§impl DnaBundle
impl DnaBundle
sourcepub fn new(
manifest: ValidatedDnaManifest,
resources: Vec<(PathBuf, ResourceBytes), Global>,
root_dir: PathBuf
) -> Result<DnaBundle, DnaError>
pub fn new( manifest: ValidatedDnaManifest, resources: Vec<(PathBuf, ResourceBytes), Global>, root_dir: PathBuf ) -> Result<DnaBundle, DnaError>
Constructor
sourcepub async fn into_dna_file(
self,
modifiers: DnaModifiersOpt<SerializedBytes>
) -> impl Future<Output = Result<(DnaFile, HoloHash<Dna>), DnaError>>
pub async fn into_dna_file( self, modifiers: DnaModifiersOpt<SerializedBytes> ) -> impl Future<Output = Result<(DnaFile, HoloHash<Dna>), DnaError>>
Convert to a DnaFile, and return what the hash of the Dna would have been without the provided modifier overrides
sourcepub async fn read_from_file(
path: &Path
) -> impl Future<Output = Result<DnaBundle, DnaError>>
pub async fn read_from_file( path: &Path ) -> impl Future<Output = Result<DnaBundle, DnaError>>
Read from a bundle file
sourcepub fn to_dna_def(
&self,
integrity_zomes: Vec<(ZomeName, IntegrityZomeDef), Global>,
coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>,
modifiers: DnaModifiersOpt<SerializedBytes>
) -> Result<(HoloHashed<DnaDef>, HoloHash<Dna>), DnaError>
pub fn to_dna_def( &self, integrity_zomes: Vec<(ZomeName, IntegrityZomeDef), Global>, coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>, modifiers: DnaModifiersOpt<SerializedBytes> ) -> Result<(HoloHashed<DnaDef>, HoloHash<Dna>), DnaError>
Convert to a DnaDef
Methods from Deref<Target = Bundle<ValidatedDnaManifest>>§
sourcepub async fn write_to_file(
&self,
path: &Path
) -> impl Future<Output = Result<(), MrBundleError>>
pub async fn write_to_file( &self, path: &Path ) -> impl Future<Output = Result<(), MrBundleError>>
Write a Bundle to a file
sourcepub async fn resolve(
&self,
location: &Location
) -> impl Future<Output = Result<Cow<'_, ResourceBytes>, MrBundleError>>
pub async fn resolve( &self, location: &Location ) -> impl Future<Output = Result<Cow<'_, ResourceBytes>, MrBundleError>>
Retrieve the bytes for a resource at a Location, downloading it if necessary
sourcepub async fn resolve_all(
&self
) -> impl Future<Output = Result<HashMap<Location, Cow<'_, ResourceBytes>, RandomState>, MrBundleError>>
pub async fn resolve_all( &self ) -> impl Future<Output = Result<HashMap<Location, Cow<'_, ResourceBytes>, RandomState>, MrBundleError>>
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.
sourcepub async fn resolve_all_cloned(
&self
) -> impl Future<Output = Result<HashMap<Location, ResourceBytes, RandomState>, MrBundleError>>
pub async fn resolve_all_cloned( &self ) -> impl Future<Output = Result<HashMap<Location, ResourceBytes, RandomState>, MrBundleError>>
Resolve all resources, but with fully owned references
sourcepub fn bundled_resources(&self) -> &BTreeMap<PathBuf, ResourceBytes, Global>
pub fn bundled_resources(&self) -> &BTreeMap<PathBuf, ResourceBytes, Global>
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
sourcepub fn encode(&self) -> Result<Vec<u8, Global>, MrBundleError>
pub fn encode(&self) -> Result<Vec<u8, Global>, MrBundleError>
An arbitrary and opaque encoding of the bundle data into a byte array
sourcepub fn find_root_dir(&self, path: &Path) -> Result<PathBuf, MrBundleError>
pub fn find_root_dir(&self, path: &Path) -> Result<PathBuf, MrBundleError>
Given that the Manifest is located at the given absolute path
, find
the absolute root directory for the “unpacked” Bundle directory.
Useful when “imploding” a directory into a bundle to determine the
default location of the generated Bundle file.
This will only be different than the Manifest path itself if the Manifest::path impl specifies a nested path.
Will return None if the path
does not actually end with the
manifest relative path, meaning that either the manifest file is
misplaced within the unpacked directory, or an incorrect path was
supplied.
sourcepub async fn unpack_yaml(
&self,
base_path: &Path,
force: bool
) -> impl Future<Output = Result<(), MrBundleError>>
pub async fn unpack_yaml( &self, base_path: &Path, force: bool ) -> impl Future<Output = Result<(), MrBundleError>>
Create a directory which contains the manifest as a YAML file,
and each resource written to its own file (as raw bytes)
The paths of the resources are specified by the paths of the bundle,
and the path of the manifest file is specified by the Manifest::path
trait method implementation of the M
type.
Trait Implementations§
source§impl AsRef<Bundle<ValidatedDnaManifest>> for DnaBundle
impl AsRef<Bundle<ValidatedDnaManifest>> for DnaBundle
source§fn as_ref(&self) -> &Bundle<ValidatedDnaManifest>
fn as_ref(&self) -> &Bundle<ValidatedDnaManifest>
source§impl<'de> Deserialize<'de> for DnaBundle
impl<'de> Deserialize<'de> for DnaBundle
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<DnaBundle, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<DnaBundle, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl PartialEq<DnaBundle> for DnaBundle
impl PartialEq<DnaBundle> for DnaBundle
source§impl Serialize for DnaBundle
impl Serialize for DnaBundle
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
source§impl TryFrom<&DnaBundle> for SerializedBytes
impl TryFrom<&DnaBundle> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(t: &DnaBundle) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaBundle) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<DnaBundle> for SerializedBytes
impl TryFrom<DnaBundle> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(t: DnaBundle) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaBundle) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<SerializedBytes> for DnaBundle
impl TryFrom<SerializedBytes> for DnaBundle
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(sb: SerializedBytes) -> Result<DnaBundle, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaBundle, SerializedBytesError>
impl Eq for DnaBundle
impl StructuralEq for DnaBundle
impl StructuralPartialEq for DnaBundle
Auto Trait Implementations§
impl RefUnwindSafe for DnaBundle
impl Send for DnaBundle
impl Sync for DnaBundle
impl Unpin for DnaBundle
impl UnwindSafe for DnaBundle
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.