8个版本
0.3.1 | 2022年5月20日 |
---|---|
0.3.0 | 2021年9月20日 |
0.2.5 | 2021年2月10日 |
0.2.4 | 2020年9月8日 |
0.1.0 |
|
#1404 在 解析器实现
834 每月下载次数
用于 12 个crate (6 直接)
79KB
2.5K SLoC
XDR RS Serialize
Xdr-rs-serialize是一个库,用于简化Rust对象到XDR格式的(反)序列化。
安装
可以通过使用Cargo安装xdr-rs-serialize crate将此库添加到您的项目中。
cargo add xdr-rs-serialize
用法
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(())
}
更复杂的示例请参阅example/下的代码
许可证
注意
- 当前不支持XDR Quad类型
依赖
~405KB