bcur 2.1.0

A Rust implementation of Uniform Resources
Documentation

bcur

A Rust implementation of Uniform Resources (URs): bytewords, fountain codes, and single- or multi-part UR strings. no_std + alloc capable; the typed dCBOR layer is behind the dcbor feature.

use bcur::fountain::EncoderOptions;
use bcur::ur::{Decoder, Encoder};
use bcur::{State, ur_type};

let data = b"Ten chars!".repeat(10);
let mut encoder = Encoder::new(ur_type!("alpha"), data.clone(), EncoderOptions::new(10)).unwrap();
let mut decoder = Decoder::default();
for frame in encoder.by_ref() {
    decoder.receive(&frame).unwrap();
    if matches!(decoder.state(), State::Complete(_)) {
        break;
    }
}
assert_eq!(decoder.into_decoded().unwrap().message(), data.as_slice());

See the documentation.

License

MIT OR Apache-2.0