Browse Source

Update `bytes` dependency to 1.0.

wip
Titouan Rigoudy 4 years ago
parent
commit
e147ab7076
6 changed files with 24 additions and 10 deletions
  1. +7
    -1
      Cargo.lock
  2. +1
    -1
      Cargo.toml
  3. +10
    -5
      src/proto/codec.rs
  4. +2
    -1
      src/proto/peer/message.rs
  5. +2
    -1
      src/proto/server/request.rs
  6. +2
    -1
      src/proto/server/response.rs

+ 7
- 1
Cargo.lock View File

@ -52,6 +52,11 @@ dependencies = [
"iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bytes"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.10"
@ -734,7 +739,7 @@ name = "solstice"
version = "0.1.0"
dependencies = [
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1099,6 +1104,7 @@ dependencies = [
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27"
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
"checksum bytes 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa"


+ 1
- 1
Cargo.toml View File

@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
byteorder = "^0.5.1"
bytes = "^0.4"
bytes = "^1.0"
crossbeam-channel = "^0.3"
encoding = "^0.2"
env_logger = "^0.3.2"


+ 10
- 5
src/proto/codec.rs View File

@ -191,14 +191,17 @@ mod tests {
#[test]
fn decode_not_enough_data_for_prefix() {
let mut bytes = BytesMut::from(vec![
let initial_bytes = vec![
4, 0, 0, // Incomplete 32-bit length prefix.
]);
];
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&initial_bytes);
let value: Option<u32> = FrameDecoder::new().decode_from(&mut bytes).unwrap();
assert_eq!(value, None);
assert_eq!(bytes, vec![4, 0, 0]); // Untouched.
assert_eq!(bytes, initial_bytes); // Untouched.
}
#[test]
@ -219,7 +222,8 @@ mod tests {
#[test]
fn decode_u32() {
let mut bytes = BytesMut::from(vec![
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&[
4, 0, 0, 0, // 1 32-bit integer = 4 bytes.
1, 3, 3, 7, // Little-endian integer.
4, 2, // Trailing bytes.
@ -233,7 +237,8 @@ mod tests {
#[test]
fn decode_vec() {
let mut bytes = BytesMut::from(vec![
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&[
20, 0, 0, 0, // 5 32-bit integers = 20 bytes.
4, 0, 0, 0, // 4 elements in the vector.
1, 0, 0, 0, // Little-endian vector elements.


+ 2
- 1
src/proto/peer/message.rs View File

@ -164,7 +164,8 @@ mod tests {
#[test]
fn invalid_code() {
let bytes = BytesMut::from(vec![57, 5, 0, 0]);
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&[57, 5, 0, 0]);
let result = ValueDecoder::new(&bytes).decode::<Message>();


+ 2
- 1
src/proto/server/request.rs View File

@ -595,7 +595,8 @@ mod tests {
#[test]
fn invalid_code() {
let bytes = BytesMut::from(vec![57, 5, 0, 0]);
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&[57, 5, 0, 0]);
let result = ValueDecoder::new(&bytes).decode::<ServerRequest>();


+ 2
- 1
src/proto/server/response.rs View File

@ -1347,7 +1347,8 @@ mod tests {
#[test]
fn invalid_code() {
let bytes = BytesMut::from(vec![57, 5, 0, 0]);
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&[57, 5, 0, 0]);
let result = ValueDecoder::new(&bytes).decode::<ServerResponse>();


Loading…
Cancel
Save