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]

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());

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug + Multihash> Debug for Seal<T>
[src]

Formats the value using the given formatter. Read more

impl<T: PartialEq + Multihash> PartialEq for Seal<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Multihash> Blot for Seal<T>
[src]

impl<T: Multihash> From<Seal<T>> for Value<T>
[src]

Performs the conversion.

Auto Trait Implementations

impl<T> Send for Seal<T> where
    T: Send

impl<T> Sync for Seal<T> where
    T: Sync