From 6be512e79c25899a09681d0e001ba5aa20226b6f Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Sat, 2 Dec 2023 12:50:28 -0700 Subject: [PATCH] cleanup interface and build Signed-off-by: Dave Huseby --- Cargo.toml | 12 ++++++++---- README.md | 4 ++-- src/error.rs | 2 +- src/lib.rs | 10 ++++++++++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 03fd2a4..17e7e53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,17 @@ [package] name = "multitrait" -version = "0.1.7" +version = "0.1.8" edition = "2021" authors = ["Dave Huseby "] -description = "Multiformat traits" +description = "Common traits for multiformats types" repository = "https://github.com/cryptidtech/multitrait.git" readme = "README.md" license = "Apache-2.0" +[features] +default = ["std"] +std = ["unsigned-varint/std"] + [dependencies] -thiserror = "1.0" -unsigned-varint = { version = "0.8", features = ["std"] } +thiserror = { version = "1.0", default-features = false } +unsigned-varint = { version = "0.8", default-features = false } diff --git a/README.md b/README.md index 6f77d88..343abcd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# multiutil -Helpful traits and functions common to multi* types. +# Multitrait +Helpful traits and functions common to multicodec types. diff --git a/src/error.rs b/src/error.rs index 672ae2e..b1f1845 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,7 +1,7 @@ use thiserror::Error; /// Errors generated by the numeric type impls -#[derive(Clone, Debug, Error, PartialEq)] +#[derive(Clone, Debug, Eq, Error, PartialEq)] #[non_exhaustive] pub enum Error { /// an unsigned-varint error diff --git a/src/lib.rs b/src/lib.rs index d9e19fb..6fab6ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,7 @@ +//! # Multiutil //! +//! A set of traits that are helpful for implementing +//! [multiformats](https://github.com/multiformats/multiformats) types in Rust. #![warn(missing_docs)] #![deny( trivial_casts, @@ -6,6 +9,13 @@ unused_import_braces, unused_qualifications )] +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(not(feature = "std"))] +extern crate alloc; + +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; /// Errors generated from the implementations pub mod error;