1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! XDR serialization and deserialization for Serde.
//!
//! This crate implements serialization to and deserialization from the External
//! Data Representation Standard ([XDR][1]) using the [Serde][2] serialization
//! and deserialization framework.
//!
//! Usage is mainly through the helper functions:
//!
//! - [`serde_xdr::ser::to_bytes`](fn.to_bytes.html)
//! - [`serde_xdr::ser::to_writer`](fn.to_writer.html)
//! - [`serde_xdr::de::from_reader`](fn.from_reader.html)
//!
//! [1]: https://tools.ietf.org/html/rfc1014
//! [2]: https://serde.rs
//!
//! # Examples
//!
//! ```
//! extern crate serde_xdr;
//! extern crate serde_bytes;
//! #[macro_use]
//! extern crate serde_derive;
//!
//! use std::io::Cursor;
//!
//! use serde_bytes::ByteBuf;
//! use serde_xdr::{from_reader, to_writer};
//!
//! #[derive(Debug, Deserialize, Eq, PartialEq, Serialize)]
//! enum FileType {
//! Text,
//! Data(String),
//! Exec(String),
//! }
//!
//! #[derive(Debug, Deserialize, Eq, PartialEq, Serialize)]
//! struct File {
//! filename: String,
//! filetype: FileType,
//! owner: String,
//! data: ByteBuf,
//! }
//!
//! fn main() {
//! let file_contents: Vec<u8> = "(quit)".as_bytes().into();
//!
//! let initial_file = File {
//! filename: "sillyprog".to_string(),
//! filetype: FileType::Exec("lisp".to_string()),
//! owner: "john".to_string(),
//! data: file_contents.into(),
//! };
//!
//! // Serialize
//! let mut bytes = Vec::new();
//!
//! to_writer(&mut bytes, &initial_file).unwrap();
//!
//! // Deserialize
//! let mut cursor = Cursor::new(bytes);
//!
//! let recovered_file = from_reader(&mut cursor).unwrap();
//!
//! assert_eq!(initial_file, recovered_file);
//! }
//! ```
extern crate failure;
extern crate failure_derive;
extern crate byteorder;
extern crate serde;
extern crate serde_derive;
extern crate ordered_float;
extern crate serde_bytes;
/// Serialization and deserialization functions for opaque data.
pub use ;
pub use ;