Skip to content

Commit cde04c1

Browse files
committed
chore: cargo fmt
1 parent ddf3504 commit cde04c1

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/network/compression.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// special thanks to james7132
22

3-
pub(crate) fn encode<'a>(reference: &[u8], pending_input: impl Iterator<Item = &'a Vec<u8>>) -> Vec<u8> {
3+
pub(crate) fn encode<'a>(
4+
reference: &[u8],
5+
pending_input: impl Iterator<Item = &'a Vec<u8>>,
6+
) -> Vec<u8> {
47
// first, do a XOR encoding to the reference input (will probably lead to a lot of same bits in sequence)
58
let buf = delta_encode(reference, pending_input);
69
// then, RLE encode the buffer (making use of the property mentioned above)
@@ -131,9 +134,9 @@ mod compression_tests {
131134
// simulate an enum whose variants serialize to different sizes
132135
let reference = vec![0u8; 1];
133136
let inputs = vec![
134-
vec![1u8], // 1 byte variant
135-
vec![2u8, 10, 20], // 3 byte variant
136-
vec![1u8], // back to 1 byte
137+
vec![1u8], // 1 byte variant
138+
vec![2u8, 10, 20], // 3 byte variant
139+
vec![1u8], // back to 1 byte
137140
vec![3u8, 1, 2, 3, 4, 5], // 6 byte variant
138141
];
139142
let encoded = encode(&reference, inputs.iter());

0 commit comments

Comments
 (0)