CborStoreExt

Trait CborStoreExt 

Source
pub trait CborStoreExt: CborStore {
    // Provided methods
    fn default_code() -> Code { ... }
    fn put_cbor_default<S: Serialize>(&self, obj: &S) -> Result<Cid> { ... }
    fn get_cbor_required<T>(&self, cid: &Cid) -> Result<T>
       where T: DeserializeOwned { ... }
}
Expand description

Extension methods for CborStore that omits default multihash code from its APIs

Provided Methods§

Source

fn default_code() -> Code

Default multihash code is [cid::multihash::Code::Blake2b256] See https://github.com/ipfs/go-ipld-cbor/blob/v0.0.6/store.go#L92

mhType := uint64(mh.BLAKE2B_MIN + 31)
// 45569 + 31 = 45600 = 0xb220
Source

fn put_cbor_default<S: Serialize>(&self, obj: &S) -> Result<Cid>

A wrapper of CborStore::put_cbor that omits code parameter to match store API in go

Source

fn get_cbor_required<T>(&self, cid: &Cid) -> Result<T>

Get typed object from block store by CID. Return an error when not found.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§