aboutsummaryrefslogtreecommitdiff
path: root/src/send.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-21 18:15:07 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-21 18:15:07 +0200
commit26989bba1409bfc093e58ef98e75885b10ad7c1c (patch)
tree92c53f668f1c5d197df026d96bbf4a0cdb7c2bbb /src/send.rs
parent9dffa812c43470ee8a29c23c3a1be73085e25843 (diff)
downloadnetapp-26989bba1409bfc093e58ef98e75885b10ad7c1c.tar.gz
netapp-26989bba1409bfc093e58ef98e75885b10ad7c1c.zip
Use Bytes instead of Vec<u8>
Diffstat (limited to 'src/send.rs')
-rw-r--r--src/send.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/send.rs b/src/send.rs
index 0179eb2..660e85c 100644
--- a/src/send.rs
+++ b/src/send.rs
@@ -3,6 +3,7 @@ use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
+use bytes::Bytes;
use async_trait::async_trait;
use log::trace;
@@ -49,7 +50,7 @@ impl From<ByteStream> for DataReader {
fn from(data: ByteStream) -> DataReader {
DataReader {
reader: data,
- packet: Ok(Vec::new()),
+ packet: Ok(Bytes::new()),
pos: 0,
buf: Vec::with_capacity(MAX_CHUNK_LENGTH as usize),
eos: false,
@@ -130,7 +131,7 @@ impl Stream for DataReader {
Ok(v) => v,
Err(e) => {
let e = *e;
- *this.packet = Ok(Vec::new());
+ *this.packet = Ok(Bytes::new());
*this.eos = true;
return Poll::Ready(Some(DataFrame::Error(e)));
}