File tree Expand file tree Collapse file tree 6 files changed +29
-1
lines changed
Expand file tree Collapse file tree 6 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1+ [ ![ ] ( https://img.shields.io/badge/made%20by-Cryptid%20Technologies-gold.svg?style=flat-square )] [ CRYPTID ]
2+ [ ![ ] ( https://img.shields.io/badge/project-provenance-purple.svg?style=flat-square )] [ PROVENANCE ]
3+ [ ![ ] ( https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square )] [ MULTIFORMATS ]
4+ ![ ] ( https://github.com/cryptidtech/multitrait/actions/workflows/rust.yml/badge.svg )
5+
16# Multitrait
2- Helpful traits and functions common to multicodec types.
7+
8+ This crate contains three helpful traits common to most/all multiformats
9+ objects:
10+
11+ ** ` EncodeInto ` **
12+ : Defines a single function for encoding a value into a ` Vec<u8> `
13+
14+ ** ` TryDecodeFrom ` **
15+ : Defines a simple interface for fallibly decoding a value from a ` &[u8] ` while
16+ tracking which bytes have been consumed.
17+
18+ ** ` Null ` **
19+ : Defines two functions for creating a "null" multiformats value and for
20+ testing if a multiformats value is the null value. This allows for the
21+ definition of a "null" CID or a "null" VLAD or even a "null" Multisig.
22+
23+ [ CRYPTID ] : https://cryptid.tech/
24+ [ PROVENANCE ] : https://github.com/cryptidtech/provenance-specifications/
25+ [ MULTIFORMATS ] : https://github.com/multiformats/multiformats/
Original file line number Diff line number Diff line change 1+ // SPDX-License-Idnetifier: Apache-2.0
12use unsigned_varint:: { decode, encode} ;
23
34/// This trait encodes a numeric value into a compact varuint Vec<u8>
Original file line number Diff line number Diff line change 1+ // SPDX-License-Idnetifier: Apache-2.0
12/// Errors generated by the numeric type impls
23#[ derive( Clone , Debug , thiserror:: Error ) ]
34#[ non_exhaustive]
Original file line number Diff line number Diff line change 1+ // SPDX-License-Idnetifier: Apache-2.0
12//! # Multiutil
23//!
34//! A set of traits that are helpful for implementing
Original file line number Diff line number Diff line change 1+ // SPDX-License-Idnetifier: Apache-2.0
12/// This trait is for multiformat objects that have a NULL value
23pub trait Null {
34 /// return an instance of Self where is_null(&self) -> true
Original file line number Diff line number Diff line change 1+ // SPDX-License-Idnetifier: Apache-2.0
12use crate :: Error ;
23use unsigned_varint:: decode;
34
You can’t perform that action at this time.
0 commit comments