Expand description
A MessagePack implementation for Rust.
ⓘ
use std::net::TcpStream;
use mpack::{Value, write_value};
let mut conn = TcpStream::connect("127.0.0.1:8081").unwrap();
// write values
write(&mut conn, 3 as i32).unwrap();
Reading values is just as easy:
ⓘ
use std::net::TcpStream;
use mpack::{Value, Reader};
let mut conn = TcpStream::connect("127.0.0.1:8081").unwrap();
let mut reader = Reader::new(conn);
let value = reader.read_value().unwrap();
// `value` can be inspected with `match` or converted directly with a convenience method
Modules§
Structs§
- Reader
- Wraps a reader instance with a place to store the last byte that was read. This simulates pushing that byte back on to the reader if it wasn’t recognized.
- Type
Error - Value
Map
Enums§
- Read
Error - An error encountered while trying to read a value.
- Value
- A value that can be sent by
msgpack
. - Write
Error - An error encountered while trying to write a value.
Traits§
- Into
Value - A trait for types that can be written via MessagePack. This is mostly a convenience to avoid having to wrap them yourself each time.
Functions§
- write
- Convenience wrapper for
write_value()
. - write_
ext - Write any value as an Extended type. On success, returns the number of bytes written.
- write_
value - Write a message in MessagePack format for the given value.