pub struct Chain {
pub links: Vec<ChainLink>,
}Expand description
A cryptographic chain of data. Each link proves it came after the previous one.
Fields§
§links: Vec<ChainLink>Implementations§
Source§impl Chain
impl Chain
Sourcepub fn append(&mut self, data: &str) -> &ChainLink
pub fn append(&mut self, data: &str) -> &ChainLink
Append a new link referencing the previous link’s fingerprint
Sourcepub fn verify(&self) -> ChainVerifyResult
pub fn verify(&self) -> ChainVerifyResult
Verify the entire chain - every link’s data AND every link’s reference to the previous link’s fingerprint
Sourcepub fn to_json(&self) -> Result<String, UniversalError>
pub fn to_json(&self) -> Result<String, UniversalError>
Serialize to JSON - safe to store in Redis, Postgres, send anywhere
Sourcepub fn from_json(s: &str) -> Result<Self, UniversalError>
pub fn from_json(s: &str) -> Result<Self, UniversalError>
Deserialize a chain from a JSON string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chain
impl<'de> Deserialize<'de> for Chain
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
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnsafeUnpin for Chain
impl UnwindSafe for Chain
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