mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
[Crate] Further use the Byteorder crate
This commit is contained in:
parent
9ad2f143dd
commit
a3cbb24d0d
1 changed files with 3 additions and 3 deletions
|
|
@ -126,9 +126,9 @@ impl Bufferer {
|
|||
}
|
||||
|
||||
let paired_buf: Vec<u16> = sub_buf.chunks_exact(2)
|
||||
.into_iter().map(|a| match self.endianess {
|
||||
Endianess::Little => u16::from_le_bytes([a[0], a[1]]),
|
||||
Endianess::Big => u16::from_be_bytes([a[0], a[1]])
|
||||
.into_iter().map(|pair| match self.endianess {
|
||||
Endianess::Little => LittleEndian::read_u16(pair),
|
||||
Endianess::Big => BigEndian::read_u16(pair)
|
||||
}).collect();
|
||||
|
||||
let value = String::from_utf16(&paired_buf).map_err(|_| PacketBad)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue