#xdr #serialization

xdr-rs-serialize

XDR object serialization for Rust

8 releases

0.3.1 May 20, 2022
0.3.0 Sep 20, 2021
0.2.5 Feb 10, 2021
0.2.4 Sep 8, 2020
0.1.0 Sep 27, 2019

#1082 in Encoding

Download history 160/week @ 2025-03-30 285/week @ 2025-04-06 227/week @ 2025-04-13 195/week @ 2025-04-20 231/week @ 2025-04-27 129/week @ 2025-05-04 151/week @ 2025-05-11 164/week @ 2025-05-18 109/week @ 2025-05-25 103/week @ 2025-06-01 138/week @ 2025-06-08 146/week @ 2025-06-15 253/week @ 2025-06-22 290/week @ 2025-06-29 294/week @ 2025-07-06 212/week @ 2025-07-13

1,062 downloads per month
Used in 15 crates (6 directly)

MIT license

79KB
2.5K SLoC

XDR RS Serialize

CircleCI

Xdr-rs-serialize is a library for facilitating the (de)serialization of rust objects into the XDR format.

Installation

This library can be added to your project by using cargo to install the xdr-rs-serialize crate.

cargo add xdr-rs-serialize

Usage

use xdr_rs_serialize::de::XDRIn;
use xdr_rs_serialize::error::Error;
use xdr_rs_serialize::ser::XDROut;

fn main() -> Result<(), Error> {
    let mut byte_buffer = Vec::new();
    "Hello world!".to_string().write_xdr(&mut byte_buffer)?;
    // Notice that a tuple is returned with the String result at index 0 and
    // total bytes read at index 1.
    let hello_world: String = String::read_xdr(&mut &byte_buffer)?.0;
    println!("{}", hello_world);
    Ok(())
}

For a more complex example see the code under example/

License

MIT

Notes

  • The XDR Quad type is currently not supported

Dependencies

~410KB