Enum holochain_zome_types::zome::ZomeDef
source · pub enum ZomeDef {
Wasm(WasmZome),
Inline {
inline_zome: DynInlineZome,
dependencies: Vec<ZomeName>,
},
}
Expand description
Just the definition of a Zome, without the name included. This exists mainly for use in HashMaps where ZomeDefs are keyed by ZomeName.
NB: Only Wasm Zomes are valid to pass through round-trip serialization, because Rust functions are not serializable. Hence, this enum serializes as if it were a bare WasmZome, and when deserializing, only Wasm zomes can be produced. InlineZomes are serialized as their network seed, so that a hash can be computed, but it is invalid to attempt to deserialize them again.
In particular, a real-world DnaFile should only ever contain Wasm zomes!
Variants§
Wasm(WasmZome)
A zome defined by Wasm bytecode
Inline
A zome defined by Rust closures. Cannot be deserialized.
Implementations§
source§impl ZomeDef
impl ZomeDef
sourcepub fn wasm_hash(&self, _zome_name: &ZomeName) -> ZomeResult<WasmHash>
pub fn wasm_hash(&self, _zome_name: &ZomeName) -> ZomeResult<WasmHash>
If this is a Wasm zome, return the WasmHash. If not, return an error with the provided zome name
sourcepub fn dependencies(&self) -> &[ZomeName]
pub fn dependencies(&self) -> &[ZomeName]
Get the dependencies of this zome.
source§impl ZomeDef
impl ZomeDef
sourcepub fn from_hash(wasm_hash: WasmHash) -> Self
pub fn from_hash(wasm_hash: WasmHash) -> Self
create a Zome from a holo_hash WasmHash instead of a holo_hash one
Examples found in repository?
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
pub fn from_hash(wasm_hash: holo_hash::WasmHash) -> Self {
Self(ZomeDef::from_hash(wasm_hash))
}
/// Erase the type of [`ZomeDef`] because you no longer
/// need to know if this is an integrity or coordinator def.
pub fn erase_type(self) -> ZomeDef {
self.0
}
}
impl CoordinatorZomeDef {
pub fn from_hash(wasm_hash: holo_hash::WasmHash) -> Self {
Self(ZomeDef::from_hash(wasm_hash))
}
Trait Implementations§
source§impl<'a> Arbitrary<'a> for ZomeDef
impl<'a> Arbitrary<'a> for ZomeDef
source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moresource§impl<'de> Deserialize<'de> for ZomeDef
impl<'de> Deserialize<'de> for ZomeDef
source§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>,
source§impl From<InlineZome<CoordinatorZomeMarker>> for ZomeDef
impl From<InlineZome<CoordinatorZomeMarker>> for ZomeDef
source§fn from(iz: InlineCoordinatorZome) -> Self
fn from(iz: InlineCoordinatorZome) -> Self
source§impl From<InlineZome<IntegrityZomeMarker>> for ZomeDef
impl From<InlineZome<IntegrityZomeMarker>> for ZomeDef
source§fn from(iz: InlineIntegrityZome) -> Self
fn from(iz: InlineIntegrityZome) -> Self
source§impl From<ZomeDef> for CoordinatorZomeDef
impl From<ZomeDef> for CoordinatorZomeDef
source§impl From<ZomeDef> for IntegrityZomeDef
impl From<ZomeDef> for IntegrityZomeDef
source§impl Ord for ZomeDef
impl Ord for ZomeDef
source§impl PartialEq<ZomeDef> for ZomeDef
impl PartialEq<ZomeDef> for ZomeDef
source§impl PartialOrd<ZomeDef> for ZomeDef
impl PartialOrd<ZomeDef> for ZomeDef
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for ZomeDef
impl StructuralEq for ZomeDef
impl StructuralPartialEq for ZomeDef
Auto Trait Implementations§
impl !RefUnwindSafe for ZomeDef
impl Send for ZomeDef
impl Sync for ZomeDef
impl Unpin for ZomeDef
impl !UnwindSafe for ZomeDef
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
§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>
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.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.