xdr-rs

Build Status

This crate provides External Data Representation(XDR) encoding and decoding functions.

The XDR format RFC at https://tools.ietf.org/html/rfc4506

Example

```rust extern crate xdr;

use xdr::xdr::{XdrWriter,XdrReader};

let mut wr = XdrWriter::new(); wr.pack(0xCCu8); wr.pack(0xAAAAu16); wr.pack(0xDEADBEEFu32); wr.pack(-1i8); wr.pack(-256i16); wr.pack(-20i32); wr.pack(100.500f32); wr.pack(-100.500e10f64);

let buf = &wr.into_buffer(); let mut rdr = XdrReader::new(buf);

asserteq!(0xCCu8,rdr.unpack::().unwrap()); asserteq!(0xAAAAu16,rdr.unpack::().unwrap()); asserteq!(0xDEADBEEFu32,rdr.unpack::().unwrap()); asserteq!(-1i8,rdr.unpack::().unwrap()); asserteq!(-256i16,rdr.unpack::().unwrap()); asserteq!(-20i32,rdr.unpack::().unwrap()); asserteq!(100.500f32,rdr.unpack::().unwrap()); asserteq!(-100.500e10f64,rdr.unpack::().unwrap()); ```

Building

cargo build # build library
cargo test # execute tests
cargo doc # compile rustdoc (wish that docs were here...)