diff --git a/Cargo.toml b/Cargo.toml index 2af3a41..5fd879a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,8 @@ repository = "https://github.com/dermesser/integer-encoding-rs" documentation = "https://docs.rs/integer-encoding/" license-file = "LICENSE" keywords = ["integer", "varint", "zigzag", "protobuf", "serialize"] +edition = "2018" [dependencies] +async-trait = "0.1" +futures = "0.3" diff --git a/src/fixed.rs b/src/fixed.rs index aa23040..380a9ad 100644 --- a/src/fixed.rs +++ b/src/fixed.rs @@ -7,9 +7,9 @@ pub trait FixedInt: Sized + Copy { /// Returns how many bytes are required to represent the given type. fn required_space() -> usize; /// Encode a value into the given slice. `dst` must be exactly `REQUIRED_SPACE` bytes. - fn encode_fixed(self, &mut [u8]); + fn encode_fixed(self, src: &mut [u8]); /// Decode a value from the given slice. `src` must be exactly `REQUIRED_SPACE` bytes. - fn decode_fixed(&[u8]) -> Self; + fn decode_fixed(src: &[u8]) -> Self; /// Perform a transmute, i.e. return a "view" into the integer's memory, which is faster than /// performing a copy. fn encode_fixed_light<'a>(&'a self) -> &'a [u8]; diff --git a/src/fixed_tests.rs b/src/fixed_tests.rs index 92ec7d0..4176d9b 100644 --- a/src/fixed_tests.rs +++ b/src/fixed_tests.rs @@ -1,9 +1,9 @@ #[cfg(test)] mod tests { - use fixed::FixedInt; + use crate::fixed::FixedInt; - use reader::FixedIntReader; - use writer::FixedIntWriter; + use crate::reader::FixedIntReader; + use crate::writer::FixedIntWriter; #[test] fn test_u32_enc() { diff --git a/src/varint.rs b/src/varint.rs index 9df391b..de295ed 100644 --- a/src/varint.rs +++ b/src/varint.rs @@ -30,10 +30,10 @@ pub trait VarInt: Sized + Copy { fn required_space(self) -> usize; /// Decode a value from the slice. Returns the value and the number of bytes read from the /// slice (can be used to read several consecutive values from a big slice) - fn decode_var(&[u8]) -> (Self, usize); + fn decode_var(src: &[u8]) -> (Self, usize); /// Encode a value into the slice. The slice must be at least `required_space()` bytes long. /// The number of bytes taken by the encoded integer is returned. - fn encode_var(self, &mut [u8]) -> usize; + fn encode_var(self, src: &mut [u8]) -> usize; /// Helper: (bit useless) - Decode value from the Vec. fn decode_var_vec(v: &Vec) -> (Self, usize) { diff --git a/src/varint_tests.rs b/src/varint_tests.rs index ce0f696..3d9438d 100644 --- a/src/varint_tests.rs +++ b/src/varint_tests.rs @@ -1,8 +1,8 @@ #[cfg(test)] mod tests { - use reader::VarIntReader; - use varint::VarInt; - use writer::VarIntWriter; + use crate::reader::VarIntReader; + use crate::varint::VarInt; + use crate::writer::VarIntWriter; #[test] fn test_required_space() { diff --git a/src/writer.rs b/src/writer.rs index 7657efd..2a0b895 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -1,7 +1,7 @@ use std::io::{Result, Write}; -use fixed::FixedInt; -use varint::VarInt; +use crate::fixed::FixedInt; +use crate::varint::VarInt; /// A trait for writing integers in VarInt encoding to any `Write` type. pub trait VarIntWriter {