Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

multiformats/rust-cid

Repository files navigation

rust-cid

Build Status Crates.io License Documentation Dependency Status Coverage Status

CID implementation in Rust.

Table of Contents

Usage

use multihash_codetable::{Code, MultihashDigest};
use cid::Cid;
use std::convert::TryFrom;
const RAW: u64 = 0x55;
fn main() {
 let h = Code::Sha2_256.digest(b"beep boop");
 let cid = Cid::new_v1(RAW, h);
 let data = cid.to_bytes();
 let out = Cid::try_from(data).unwrap();
 assert_eq!(cid, out);
 let cid_string = cid.to_string();
 assert_eq!(
 cid_string,
 "bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq"
 );
 println!("{}", cid_string);
}

You can use this package by adding it to your Cargo.toml with cargo add cid.

Testing

You can run the tests using this command: cargo test --all-features

You can run the tests for no_std using this command: cargo test --no-default-features

Maintainers

Captain: @dignifiedquire.

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2017 Friedel Ziegelmayer

Packages

No packages published

Contributors 32

Languages

AltStyle によって変換されたページ (->オリジナル) /