pub struct SchemaArtifact {
pub id: String,
pub name: String,
pub version: String,
pub body: Value,
}Expand description
A content-addressed schema or reducer artifact.
The id is derived from the canonical serialization of
(name, version, body). Equal artifacts have equal ids;
different artifacts have ids that differ except with negligible
probability under SHA-256.
Fields§
§id: StringContent-addressed id, prefixed with vsa_ (Vela Schema
Artifact). This is H(canonical(name, version, body)).
name: StringHuman-readable name (e.g. vela.event.finding_asserted).
version: StringSemver-style version string (e.g. v0.1).
body: ValueBody of the artifact: the actual schema or reducer specification, kept as a JSON value to avoid committing to any one schema language at the substrate layer.
Implementations§
Source§impl SchemaArtifact
impl SchemaArtifact
Sourcepub fn new(
name: impl Into<String>,
version: impl Into<String>,
body: Value,
) -> Result<Self, String>
pub fn new( name: impl Into<String>, version: impl Into<String>, body: Value, ) -> Result<Self, String>
Build a new artifact, computing the content-addressed id
from the canonical serialization of (name, version, body).
Trait Implementations§
Source§impl Clone for SchemaArtifact
impl Clone for SchemaArtifact
Source§fn clone(&self) -> SchemaArtifact
fn clone(&self) -> SchemaArtifact
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaArtifact
impl Debug for SchemaArtifact
Source§impl<'de> Deserialize<'de> for SchemaArtifact
impl<'de> Deserialize<'de> for SchemaArtifact
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SchemaArtifact
impl PartialEq for SchemaArtifact
Source§fn eq(&self, other: &SchemaArtifact) -> bool
fn eq(&self, other: &SchemaArtifact) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SchemaArtifact
impl Serialize for SchemaArtifact
impl Eq for SchemaArtifact
impl StructuralPartialEq for SchemaArtifact
Auto Trait Implementations§
impl Freeze for SchemaArtifact
impl RefUnwindSafe for SchemaArtifact
impl Send for SchemaArtifact
impl Sync for SchemaArtifact
impl Unpin for SchemaArtifact
impl UnsafeUnpin for SchemaArtifact
impl UnwindSafe for SchemaArtifact
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.