From a1f463e1772db4dfd3ce21056d5bce2327ae4f53 Mon Sep 17 00:00:00 2001 From: ryan-rsm-mckenzie Date: Sun, 28 Jan 2024 12:55:07 -0800 Subject: [PATCH] use passed endian, instead of native endian not technically a bug, but still... --- src/protocols.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols.rs b/src/protocols.rs index b8054c7..6ed046b 100644 --- a/src/protocols.rs +++ b/src/protocols.rs @@ -38,14 +38,14 @@ impl<'bytes> BinaryReadable<'bytes> for BString { impl BinaryWriteable for BString { type Item = ByteStr; - fn to_stream(stream: &mut Sink, item: &Self::Item, _: Endian) -> io::Result<()> + fn to_stream(stream: &mut Sink, item: &Self::Item, endian: Endian) -> io::Result<()> where Out: Write, { let len: Result = item.len().try_into(); match len { Ok(len) => { - stream.write_bytes(&len.to_ne_bytes())?; + stream.write(&len, endian)?; stream.write_bytes(item)?; Ok(()) } @@ -118,14 +118,14 @@ impl<'bytes> BinaryReadable<'bytes> for BZString { impl BinaryWriteable for BZString { type Item = ByteStr; - fn to_stream(stream: &mut Sink, item: &Self::Item, _: Endian) -> io::Result<()> + fn to_stream(stream: &mut Sink, item: &Self::Item, endian: Endian) -> io::Result<()> where Out: Write, { let len: Result = (item.len() + 1).try_into(); match len { Ok(len) => { - stream.write_bytes(&len.to_ne_bytes())?; + stream.write(&len, endian)?; stream.write_bytes(item)?; stream.write_bytes(b"\0")?; Ok(())