Struct blot::seal::Seal [−][src]
pub struct Seal<T: Multihash> { /* fields omitted */ }
The Seal type. See the module level documentation for more.
Methods
impl<T: Multihash> Seal<T>[src]
impl<T: Multihash> Seal<T>pub fn digest(&self) -> &[u8][src]
pub fn digest(&self) -> &[u8]pub fn tag(&self) -> &T[src]
pub fn tag(&self) -> &Tpub fn digest_hex(&self) -> String[src]
pub fn digest_hex(&self) -> Stringpub fn from_str(input: &str) -> Result<Seal<T>, SealError>[src]
pub fn from_str(input: &str) -> Result<Seal<T>, SealError>Creates a Seal from a string. The string must have either the Objecthash prefix
**REDACTED** or the blot SEAL_MARK.
You can use [from_bytes] if you have a list of bytes.
Examples
use blot::seal::Seal; use blot::multihash::{Multihash, Sha2256}; let seal_classic: Result<Seal<Sha2256>, _> = Seal::from_str("**REDACTED**1220a6a6e5e783c363cd95693ec189c2682315d956869397738679b56305f2095038"); let seal: Result<Seal<Sha2256>, _> = Seal::from_str("771220a6a6e5e783c363cd95693ec189c2682315d956869397738679b56305f2095038"); assert!(seal_classic.is_ok()); assert!(seal.is_ok()); assert_eq!(seal.unwrap(), seal_classic.unwrap());
pub fn from_bytes(bytes: &[u8]) -> Result<Seal<T>, SealError>[src]
pub fn from_bytes(bytes: &[u8]) -> Result<Seal<T>, SealError>Creates a Seal from a list of bytes. The first byte must be the
SEAL_MARK.
You can use [from_str] if your redacted hash uses the original Objecthash "**REDACTED**" prefix.
Examples
use blot::seal::Seal; use blot::multihash::{Multihash, Sha2256}; use hex::FromHex; let bytes = Vec::from_hex("771220a6a6e5e783c363cd95693ec189c2682315d956869397738679b56305f2095038").unwrap(); let seal: Result<Seal<Sha2256>, _> = Seal::from_bytes(&bytes); assert!(seal.is_ok());
Errors
This operation fails with SealError::NotRedacted if the first byte is not 0x77, the
seal mark.
Trait Implementations
impl<T: Clone + Multihash> Clone for Seal<T>[src]
impl<T: Clone + Multihash> Clone for Seal<T>fn clone(&self) -> Seal<T>[src]
fn clone(&self) -> Seal<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl<T: Debug + Multihash> Debug for Seal<T>[src]
impl<T: Debug + Multihash> Debug for Seal<T>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: PartialEq + Multihash> PartialEq for Seal<T>[src]
impl<T: PartialEq + Multihash> PartialEq for Seal<T>fn eq(&self, other: &Seal<T>) -> bool[src]
fn eq(&self, other: &Seal<T>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Seal<T>) -> bool[src]
fn ne(&self, other: &Seal<T>) -> boolThis method tests for !=.
impl<T: Multihash> Blot for Seal<T>[src]
impl<T: Multihash> Blot for Seal<T>fn blot<D: Multihash>(&self, _: &D) -> Harvest[src]
fn blot<D: Multihash>(&self, _: &D) -> Harvestfn digest<D: Multihash>(&self, digester: D) -> Hash<D>[src]
fn digest<D: Multihash>(&self, digester: D) -> Hash<D>impl<T: Multihash> From<Seal<T>> for Value<T>[src]
impl<T: Multihash> From<Seal<T>> for Value<T>