Skip to content

Commit

Permalink
io: replace Vec<u8> for BytesMut in Buf
Browse files Browse the repository at this point in the history
As hinted in tokio-rs#1976 (comment)
this change replaces the inner buf attribute of the Buf struct.
  • Loading branch information
blasrodri committed Aug 3, 2020
1 parent 7276d47 commit 06d67ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tokio/src/io/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::pin::Pin;
use std::task::Poll::*;
use std::task::{Context, Poll};

use bytes::BytesMut;

use self::State::*;

/// `T` should not implement _both_ Read and Write.
Expand All @@ -22,7 +24,7 @@ pub(crate) struct Blocking<T> {

#[derive(Debug)]
pub(crate) struct Buf {
buf: Vec<u8>,
buf: BytesMut,
pos: usize,
}

Expand Down Expand Up @@ -190,7 +192,7 @@ macro_rules! uninterruptibly {
impl Buf {
pub(crate) fn with_capacity(n: usize) -> Buf {
Buf {
buf: Vec::with_capacity(n),
buf: BytesMut::with_capacity(n),
pos: 0,
}
}
Expand Down

0 comments on commit 06d67ac

Please sign in to comment.