Skip to content

Commit

Permalink
Upgrade to edition 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
dermesser committed Feb 21, 2020
1 parent 67b6156 commit c9e1a80
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions src/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions src/fixed_tests.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/varint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>) -> (Self, usize) {
Expand Down
6 changes: 3 additions & 3 deletions src/varint_tests.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/writer.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit c9e1a80

Please sign in to comment.