Skip to content

Commit

Permalink
fix README, add license tags
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Huseby <[email protected]>
  • Loading branch information
dhuseby committed Apr 7, 2024
1 parent 753d6b3 commit c262b32
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 2 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# multiutil
[![](https://img.shields.io/badge/made%20by-Cryptid%20Technologies-gold.svg?style=flat-square)][CRYPTID]
[![](https://img.shields.io/badge/project-provenance-purple.svg?style=flat-square)][PROVENANCE]
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)][MULTIFORMATS]
![](https://github.com/cryptidtech/multitrait/actions/workflows/rust.yml/badge.svg)

Helpful traits, types, and functions for constructing multicodec types.
# Multiutil

Helpful traits, types, and functions for constructing multiformat types.

## BaseEncoded

The `BaseEncoded` "smart pointer" wraps any multiformat type that implements
the `EncodingInfo` trait also found in this crate. `BaseEncoding` automatically
handles base encoding the inner value using the [Multibase][MULTIBASE] text
encoding systems.

## CodecInfo

The `CodecInfo` trait allows a multiformat type to expose its
[Multicodec][MULTICODEC] value to code that relies on this trait.

## Varuint

This is an implementation of a [variable length, unsigned integer][VARUINT]
that is common to all multiformat protocols and types.

## Varbytes

This is the combination of a `Varuint` followed by a binary octet array of
equal length. This is a common way to encode arbitrary binary data so that any
code can skip over the data if it doesn't know how, nor want, to process it

```
<varbytes> ::= <varuint> N(OCTET)
^ ^
/ \
count of variable number
octets of octets
```

[CRYPTID]: https://cryptid.tech/
[PROVENANCE]: https://github.com/cryptidtech/provenance-specifications/
[MULTIFORMATS]: https://github.com/multiformats/multiformats/
[MULTIBASE]: https://github.com/multiformats/multibase
[VARUINT]: https://github.com/multiformats/unsigned-varint
1 change: 1 addition & 0 deletions src/base_encoded.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
error::BaseEncodedError, prelude::Base, BaseEncoder, EncodingInfo, Error, DetectedEncoder,
};
Expand Down
1 change: 1 addition & 0 deletions src/base_encoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
base_name,
error::{BaseEncodedError, BaseEncoderError},
Expand Down
1 change: 1 addition & 0 deletions src/base_name.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::prelude::Base;

/// convert a multibase Base to its string equivalent
Expand Down
1 change: 1 addition & 0 deletions src/codec_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::prelude::Codec;

/// This trait exposes the codec information for multicoded types
Expand Down
1 change: 1 addition & 0 deletions src/encoding_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::prelude::Base;

/// This trait exposes the preferred encoding for this multicodec type
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
/// Errors generated by the numeric type impls
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
//!
#![warn(missing_docs)]
#![deny(
Expand Down
1 change: 1 addition & 0 deletions src/serde/de.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{BaseEncoded, BaseEncoder, EncodingInfo, Varbytes, Varuint};
use core::{fmt, marker};
use multibase::Base;
Expand Down
1 change: 1 addition & 0 deletions src/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
//! Serde (de)serialization for ['crate::prelude::Tagged'] wrapped objects
mod de;
mod ser;
Expand Down
1 change: 1 addition & 0 deletions src/serde/ser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{BaseEncoded, BaseEncoder, EncodingInfo, Varbytes, Varuint};
use multitrait::prelude::EncodeInto;
use serde::ser;
Expand Down
1 change: 1 addition & 0 deletions src/varbytes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{BaseEncoded, EncodingInfo, Error};
use core::{fmt, ops};
use multibase::Base;
Expand Down
1 change: 1 addition & 0 deletions src/varuint.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{BaseEncoded, EncodingInfo, Error};
use core::{fmt, ops};
use multibase::Base;
Expand Down

0 comments on commit c262b32

Please sign in to comment.