diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-21 18:15:07 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-21 18:15:07 +0200 |
commit | 26989bba1409bfc093e58ef98e75885b10ad7c1c (patch) | |
tree | 92c53f668f1c5d197df026d96bbf4a0cdb7c2bbb /src/recv.rs | |
parent | 9dffa812c43470ee8a29c23c3a1be73085e25843 (diff) | |
download | netapp-26989bba1409bfc093e58ef98e75885b10ad7c1c.tar.gz netapp-26989bba1409bfc093e58ef98e75885b10ad7c1c.zip |
Use Bytes instead of Vec<u8>
Diffstat (limited to 'src/recv.rs')
-rw-r--r-- | src/recv.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/recv.rs b/src/recv.rs index f5221e6..abe7b9a 100644 --- a/src/recv.rs +++ b/src/recv.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; +use bytes::Bytes; use log::trace; use futures::channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}; @@ -85,7 +86,7 @@ pub(crate) trait RecvLoop: Sync + 'static { let mut next_slice = vec![0; size as usize]; read.read_exact(&mut next_slice[..]).await?; trace!("recv_loop: read {} bytes", next_slice.len()); - Ok(next_slice) + Ok(Bytes::from(next_slice)) }; let mut sender = if let Some(send) = streams.remove(&(id)) { |