pub struct DnaFile { /* private fields */ }
Expand description
Represents a full DNA, including DnaDef and WebAssembly bytecode.
Historical note: This struct was written before DnaBundle
was introduced.
This used to be our file representation of a full distributable DNA.
That function has been superseded by DnaBundle
, but we use this type
widely, so there is simply a way to convert from DnaBundle
to DnaFile
.
TODO: Once we remove the InstallApp
command which accepts a DnaFile
,
we should remove the Serialize impl on this type, and perhaps rename
to indicate that this is simply a validated, fully-formed DnaBundle
(i.e. all Wasms are bundled and immediately available, not remote.)
Implementations
sourceimpl DnaFile
impl DnaFile
sourcepub async fn new(
dna: DnaDef,
wasm: impl IntoIterator<Item = DnaWasm>
) -> impl Future<Output = DnaFile>
pub async fn new(
dna: DnaDef,
wasm: impl IntoIterator<Item = DnaWasm>
) -> impl Future<Output = DnaFile>
Construct a new DnaFile instance.
sourcepub async fn update_coordinators(
&mut self,
coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>,
wasms: Vec<DnaWasm, Global>
) -> impl Future<Output = Result<Vec<HoloHash<Wasm>, Global>, DnaError>>
pub async fn update_coordinators(
&mut self,
coordinator_zomes: Vec<(ZomeName, CoordinatorZomeDef), Global>,
wasms: Vec<DnaWasm, Global>
) -> impl Future<Output = Result<Vec<HoloHash<Wasm>, Global>, DnaError>>
Update coordinator zomes for this dna.
sourcepub fn from_parts(dna: HoloHashed<DnaDef>, code: WasmMap) -> DnaFile
pub fn from_parts(dna: HoloHashed<DnaDef>, code: WasmMap) -> DnaFile
Construct a DnaFile from its constituent parts
sourcepub fn dna(&self) -> &HoloHashed<DnaDef>
pub fn dna(&self) -> &HoloHashed<DnaDef>
The DnaDef along with its hash
sourcepub fn verify_hash(&self) -> Result<(), DnaError>
pub fn verify_hash(&self) -> Result<(), DnaError>
Verify that the DNA hash in the file matches the DnaDef
sourcepub async fn from_file_content(
data: &[u8]
) -> impl Future<Output = Result<DnaFile, DnaError>>
👎Deprecated: remove after app bundles become standard; use DnaBundle instead
pub async fn from_file_content(
data: &[u8]
) -> impl Future<Output = Result<DnaFile, DnaError>>
Load dna_file bytecode into this rust struct.
sourcepub async fn with_properties(
self,
properties: SerializedBytes
) -> impl Future<Output = DnaFile>
pub async fn with_properties(
self,
properties: SerializedBytes
) -> impl Future<Output = DnaFile>
Transform this DnaFile into a new DnaFile with different properties and, hence, a different DnaHash.
sourcepub async fn with_network_seed(
self,
network_seed: String
) -> impl Future<Output = DnaFile>
pub async fn with_network_seed(
self,
network_seed: String
) -> impl Future<Output = DnaFile>
Transform this DnaFile into a new DnaFile with a different network seed and, hence, a different DnaHash.
sourcepub fn code(&self) -> &BTreeMap<HoloHash<Wasm>, DnaWasm, Global>
pub fn code(&self) -> &BTreeMap<HoloHash<Wasm>, DnaWasm, Global>
The bytes of the WASM zomes referenced in the Dna portion.
sourcepub fn get_wasm_for_zome(
&self,
zome_name: &ZomeName
) -> Result<&DnaWasm, DnaError>
pub fn get_wasm_for_zome(
&self,
zome_name: &ZomeName
) -> Result<&DnaWasm, DnaError>
Fetch the Webassembly byte code for a zome.
sourcepub async fn to_file_content(
&self
) -> impl Future<Output = Result<Vec<u8, Global>, DnaError>>
👎Deprecated: remove after app bundles become standard; use DnaBundle instead
pub async fn to_file_content(
&self
) -> impl Future<Output = Result<Vec<u8, Global>, DnaError>>
Render this dna_file as bytecode to send over the wire, or store in a file.
sourcepub fn update_modifiers(
&self,
dna_modifiers: DnaModifiersOpt<SerializedBytes>
) -> DnaFile
pub fn update_modifiers(
&self,
dna_modifiers: DnaModifiersOpt<SerializedBytes>
) -> DnaFile
Change the DNA modifiers – the network seed, origin time and properties – while leaving the actual DNA code intact.
Trait Implementations
sourceimpl AsRef<DnaFile> for SweetDnaFile
impl AsRef<DnaFile> for SweetDnaFile
sourceimpl Borrow<DnaFile> for SweetDnaFile
impl Borrow<DnaFile> for SweetDnaFile
sourceimpl<'de> Deserialize<'de> for DnaFile
impl<'de> Deserialize<'de> for DnaFile
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<DnaFile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DnaFile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
sourceimpl From<DnaFile> for DnaWithRole
impl From<DnaFile> for DnaWithRole
sourceimpl From<DnaFile> for SweetDnaFile
impl From<DnaFile> for SweetDnaFile
sourcefn from(original: DnaFile) -> SweetDnaFile
fn from(original: DnaFile) -> SweetDnaFile
sourceimpl From<SweetDnaFile> for DnaFile
impl From<SweetDnaFile> for DnaFile
sourcefn from(original: SweetDnaFile) -> Self
fn from(original: SweetDnaFile) -> Self
sourceimpl Serialize for DnaFile
impl Serialize for DnaFile
sourcefn 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,
sourceimpl TryFrom<&DnaFile> for SerializedBytes
impl TryFrom<&DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DnaFile) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<DnaFile> for SerializedBytes
impl TryFrom<DnaFile> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DnaFile) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<SerializedBytes> for DnaFile
impl TryFrom<SerializedBytes> for DnaFile
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DnaFile, SerializedBytesError>
impl Eq for DnaFile
impl StructuralEq for DnaFile
impl StructuralPartialEq for DnaFile
Auto Trait Implementations
impl !RefUnwindSafe for DnaFile
impl Send for DnaFile
impl Sync for DnaFile
impl Unpin for DnaFile
impl !UnwindSafe for DnaFile
Blanket Implementations
impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn 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>
sourceimpl<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,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.impl<T> FutureExt for T
impl<T> FutureExt for T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
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 morefn 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.impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;