pub trait AnagolayStructureData: Default + Encode + Clone + PartialEq + Eq {
    fn validate(&self) -> Result<(), Characters>;

    fn to_cid(&self) -> GenericId { ... }
}
Expand description

The trait for the data field of an Anagolay entity.

Required methods

Provided methods

Computes cid of the data, after encoding it using parity SCALE codec

Examples
use codec::{Decode, Encode};
use anagolay_support::{AnagolayStructureData, AnagolayStructureExtra, Characters};

#[derive(Encode, Decode, Clone, PartialEq, Eq)]
struct EntityData {
  text: Vec<u8>
};

impl Default for EntityData {
  fn default() -> Self {
    EntityData {
      text: b"".to_vec()
    }
  }
}

impl AnagolayStructureData for EntityData {
  fn validate(&self) -> Result<(), Characters> {
     Ok(())
  }
}

let entity = EntityData {
  text: b"hello".to_vec()
};

let cid = entity.to_cid();

Implementors

Implementation of AnagolayStructureData trait for AnagolayVersionData