summaryrefslogtreecommitdiffstats
path: root/third_party/rust/bincode/src/config/endian.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/bincode/src/config/endian.rs')
-rw-r--r--third_party/rust/bincode/src/config/endian.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/rust/bincode/src/config/endian.rs b/third_party/rust/bincode/src/config/endian.rs
new file mode 100644
index 0000000000..2561620a2f
--- /dev/null
+++ b/third_party/rust/bincode/src/config/endian.rs
@@ -0,0 +1,27 @@
+pub trait BincodeByteOrder {
+ type Endian: ::byteorder::ByteOrder + 'static;
+}
+
+/// Little-endian byte ordering.
+#[derive(Copy, Clone)]
+pub struct LittleEndian;
+
+/// Big-endian byte ordering.
+#[derive(Copy, Clone)]
+pub struct BigEndian;
+
+/// The native byte ordering of the current system.
+#[derive(Copy, Clone)]
+pub struct NativeEndian;
+
+impl BincodeByteOrder for LittleEndian {
+ type Endian = ::byteorder::LittleEndian;
+}
+
+impl BincodeByteOrder for BigEndian {
+ type Endian = ::byteorder::BigEndian;
+}
+
+impl BincodeByteOrder for NativeEndian {
+ type Endian = ::byteorder::NativeEndian;
+}