Skip to content

Commit 497864e

Browse files
committed
update bytes crate
1 parent 00e3a20 commit 497864e

File tree

11 files changed

+21
-30
lines changed

11 files changed

+21
-30
lines changed

lib/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ readme = "../README.md"
1313

1414
[dependencies]
1515
neo4rs-macros = { version = "0.2.0", path = "../macros" }
16-
futures = { version = "0.3.1" }
16+
futures = { version = "0.3.8" }
1717
tokio = { version = "1.0.1", features = ["full"] }
18-
bytes = "0.5"
18+
bytes = "1.0.0"
1919
async-trait = "0.1.42"
2020
deadpool = "0.6.0"
2121
chrono = "0.4.19"

lib/src/types/binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ mod tests {
8383
let serialized: Bytes = bolt_bytes.to_bytes(Version::V4_1).unwrap();
8484

8585
assert_eq!(
86-
serialized.bytes(),
86+
&serialized[..],
8787
Bytes::from_static(&[SMALL, 0x05, b'h', b'e', b'l', b'l', b'o'])
8888
);
8989

lib/src/types/boolean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ mod tests {
5050
fn should_serialize_boolean() {
5151
let bolt_boolean = BoltBoolean::new(true);
5252
let b: Bytes = bolt_boolean.to_bytes(Version::V4_1).unwrap();
53-
assert_eq!(b.bytes(), &[0xC3]);
53+
assert_eq!(&b[..], &[0xC3]);
5454

5555
let bolt_boolean = BoltBoolean::new(false);
5656
let b: Bytes = bolt_boolean.to_bytes(Version::V4_1).unwrap();
57-
assert_eq!(b.bytes(), &[0xC2]);
57+
assert_eq!(&b[..], &[0xC2]);
5858
}
5959

6060
#[test]

lib/src/types/duration.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ mod tests {
6262

6363
let bytes: Bytes = duration.to_bytes(Version::V4_1).unwrap();
6464

65-
println!("{:#04X?}", bytes.bytes());
66-
6765
assert_eq!(
6866
bytes,
6967
Bytes::from_static(&[0xB4, 0x45, 0x0C, 0x02, 0x1E, 0xC9, 0x02, 0xBC,])

lib/src/types/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ mod tests {
4646
fn should_serialize_float() {
4747
let b: Bytes = BoltFloat::new(1.23).to_bytes(Version::V4_1).unwrap();
4848
assert_eq!(
49-
b.bytes(),
49+
&b[..],
5050
&[0xC1, 0x3F, 0xF3, 0xAE, 0x14, 0x7A, 0xE1, 0x47, 0xAE]
5151
);
5252

5353
let b: Bytes = BoltFloat::new(-1.23).to_bytes(Version::V4_1).unwrap();
5454
assert_eq!(
55-
b.bytes(),
55+
&b[..],
5656
&[0xC1, 0xBF, 0xF3, 0xAE, 0x14, 0x7A, 0xE1, 0x47, 0xAE,]
5757
);
5858
}

lib/src/types/integer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,24 @@ mod tests {
115115
fn should_serialize_integer() {
116116
let bolt_int = BoltInteger::new(42);
117117
let b: Bytes = bolt_int.to_bytes(Version::V4_1).unwrap();
118-
assert_eq!(b.bytes(), &[0x2A]);
118+
assert_eq!(&b[..], &[0x2A]);
119119

120120
let bolt_int = BoltInteger::new(-127);
121121
let b: Bytes = bolt_int.to_bytes(Version::V4_1).unwrap();
122-
assert_eq!(b.bytes(), &[INT_8, 0x81]);
122+
assert_eq!(&b[..], &[INT_8, 0x81]);
123123

124124
let bolt_int = BoltInteger::new(129);
125125
let b: Bytes = bolt_int.to_bytes(Version::V4_1).unwrap();
126-
assert_eq!(b.bytes(), &[INT_16, 0x00, 0x81]);
126+
assert_eq!(&b[..], &[INT_16, 0x00, 0x81]);
127127

128128
let bolt_int = BoltInteger::new(32_768);
129129
let b: Bytes = bolt_int.to_bytes(Version::V4_1).unwrap();
130-
assert_eq!(b.bytes(), &[INT_32, 0x00, 0x00, 0x80, 0x00]);
130+
assert_eq!(&b[..], &[INT_32, 0x00, 0x00, 0x80, 0x00]);
131131

132132
let bolt_int = BoltInteger::new(2_147_483_648);
133133
let b: Bytes = bolt_int.to_bytes(Version::V4_1).unwrap();
134134
assert_eq!(
135-
b.bytes(),
135+
&b[..],
136136
&[INT_64, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00]
137137
);
138138
}

lib/src/types/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mod tests {
149149

150150
let b: Bytes = list.to_bytes(Version::V4_1).unwrap();
151151

152-
assert_eq!(b.bytes(), Bytes::from_static(&[TINY]));
152+
assert_eq!(&b[..], Bytes::from_static(&[TINY]));
153153
}
154154

155155
#[test]
@@ -160,7 +160,7 @@ mod tests {
160160

161161
let b: Bytes = list.to_bytes(Version::V4_1).unwrap();
162162

163-
assert_eq!(b.bytes(), Bytes::from_static(&[0x92, 0x81, 0x61, 0x01]));
163+
assert_eq!(&b[..], Bytes::from_static(&[0x92, 0x81, 0x61, 0x01]));
164164
}
165165

166166
#[test]

lib/src/types/map.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ mod tests {
148148

149149
let b: Bytes = map.to_bytes(Version::V4_1).unwrap();
150150

151-
assert_eq!(b.bytes(), Bytes::from_static(&[TINY]));
151+
assert_eq!(&b[..], Bytes::from_static(&[TINY]));
152152
}
153153

154154
#[test]
@@ -158,10 +158,7 @@ mod tests {
158158

159159
let b: Bytes = map.to_bytes(Version::V4_1).unwrap();
160160

161-
assert_eq!(
162-
b.bytes(),
163-
Bytes::from_static(&[0xA1, 0x81, 0x61, 0x81, 0x62])
164-
);
161+
assert_eq!(&b[..], Bytes::from_static(&[0xA1, 0x81, 0x61, 0x81, 0x62]));
165162
}
166163

167164
#[test]

lib/src/types/null.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ mod tests {
2020
fn should_serialize_null() {
2121
let null = BoltNull::new();
2222
let b: Bytes = null.to_bytes(Version::V4_1).unwrap();
23-
assert_eq!(b.bytes(), &[0xC0]);
23+
assert_eq!(&b[..], &[0xC0]);
2424
}
2525
}

lib/src/types/point.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ mod tests {
3636

3737
let bytes: Bytes = point.to_bytes(Version::V4_1).unwrap();
3838

39-
println!("{:#04X?}", bytes.bytes());
40-
4139
assert_eq!(
42-
bytes,
40+
&bytes[..],
4341
Bytes::from_static(&[
4442
0xB3, 0x58, 0x2A, 0xC1, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x40,
4543
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -72,10 +70,8 @@ mod tests {
7270

7371
let bytes: Bytes = point.to_bytes(Version::V4_1).unwrap();
7472

75-
println!("{:#04X?}", bytes.bytes());
76-
7773
assert_eq!(
78-
bytes,
74+
&bytes[..],
7975
Bytes::from_static(&[
8076
0xB4, 0x59, 0x2A, 0xC1, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x40,
8177
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00,

0 commit comments

Comments
 (0)