Crates.io | iscc-rs |
lib.rs | iscc-rs |
version | 0.2.0 |
source | src |
created_at | 2019-07-13 17:10:37.882862 |
updated_at | 2019-07-28 14:17:56.403451 |
description | Rust implementation of the ISCC specification |
homepage | https://iscc.codes |
repository | https://github.com/iscc/iscc-rs |
max_upload_size | |
id | 148816 |
size | 48,158 |
Rust implementation of the ISCC specification
Add this to your Cargo.toml
:
[dependencies]
iscc-rs = "0.2"
This example shows how to create an ISCC Code.
use std::error::Error;
use iscc::{content_id_text, data_id, instance_id, meta_id};
fn main() -> Result<(), Box<dyn Error>> {
// Generate ISCC Component Codes
let (mid, _title, _extra) = meta_id("Title of Content", "");
let cid = content_id_text("some text", false);
let did = data_id("tests/test_data/mediafile.html")?;
let (iid, _tophash) = instance_id("tests/test_data/mediafile.html")?;
// Join ISCC Components to fully qualified ISCC Code
let iscc_code = [mid, cid, did, iid].join("-");
println!("ISCC: {}", iscc_code);
Ok(())
}