mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-26 04:06:15 +00:00
ByteBuffer: use T: AsyncRead, not AsyncReadExt
it's just weird otherwise Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
7856139d72
commit
2aeeb83203
@ -21,7 +21,7 @@ use std::io::{Read, Result};
|
|||||||
|
|
||||||
use crate::tools::vec;
|
use crate::tools::vec;
|
||||||
|
|
||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||||
|
|
||||||
/// A Buffer that holds bytes (u8)
|
/// A Buffer that holds bytes (u8)
|
||||||
/// has convenience methods for reading (with any reader that
|
/// has convenience methods for reading (with any reader that
|
||||||
@ -159,7 +159,7 @@ impl ByteBuffer {
|
|||||||
|
|
||||||
/// Same as read_from, but for reader that implement tokio::io::AsyncRead.
|
/// Same as read_from, but for reader that implement tokio::io::AsyncRead.
|
||||||
/// See [read_from](#method.read_from) for an example
|
/// See [read_from](#method.read_from) for an example
|
||||||
pub async fn read_from_async<T: AsyncReadExt + Unpin>(&mut self, input: &mut T) -> Result<usize> {
|
pub async fn read_from_async<T: AsyncRead + Unpin>(&mut self, input: &mut T) -> Result<usize> {
|
||||||
let amount = input.read(self.get_free_mut_slice()).await?;
|
let amount = input.read(self.get_free_mut_slice()).await?;
|
||||||
self.add_size(amount);
|
self.add_size(amount);
|
||||||
Ok(amount)
|
Ok(amount)
|
||||||
|
Loading…
Reference in New Issue
Block a user