Crate messagepack_core

Crate messagepack_core 

Source
Expand description

§messagepack-core

messagepack for no_std

§Example

use messagepack_core::{Decode, Encode, io::{SliceWriter, SliceReader}};

let mut buf = [0u8; 12];
let mut writer = SliceWriter::from_slice(&mut buf);
let written = "MessagePack".encode(&mut writer).unwrap();

assert_eq!(
    buf,
    [
        0xab, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x63, 0x6b
    ]
);
assert_eq!(written, 12);

let mut reader = SliceReader::new(&buf);
let decoded = <&str as Decode>::decode(&mut reader).unwrap();
assert_eq!(decoded, "MessagePack");
assert_eq!(reader.rest().len(), 0);

§License

Licensed under either of

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Re-exports§

pub use decode::Decode;
pub use encode::Encode;
pub use io::SliceWriter;

Modules§

decode
Decoding primitives for MessagePack.
encode
Encoding primitives for MessagePack.
extension
MessagePack extension helpers.
io
Minimal write abstraction used by encoders.
timestamp
MessagePack timestamp extension values.

Enums§

Format
MessagePack format marker.