| 250 | |
| 251 | #[test] |
| 252 | fn test_from_bytes() { |
| 253 | let message = b"hello arrow"; |
| 254 | |
| 255 | // we can create a Bytes from bytes::Bytes (created from slices) |
| 256 | let c_bytes: bytes::Bytes = message.as_ref().into(); |
| 257 | let a_bytes: Bytes = c_bytes.into(); |
| 258 | assert_eq!(a_bytes.as_slice(), message); |
| 259 | |
| 260 | // we can create a Bytes from bytes::Bytes (created from Vec) |
| 261 | let c_bytes: bytes::Bytes = bytes::Bytes::from(message.to_vec()); |
| 262 | let a_bytes: Bytes = c_bytes.into(); |
| 263 | assert_eq!(a_bytes.as_slice(), message); |
| 264 | } |
| 265 | |
| 266 | #[cfg(feature = "pool")] |
| 267 | mod pool_tests { |