mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-05 18:00:26 +00:00
ByteBuffer: don't require Sized on Read references
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
8bae897ff6
commit
a45555df07
@ -6,7 +6,7 @@
|
||||
//! ```
|
||||
//! # use std::io::Read;
|
||||
//! # use proxmox::tools::byte_buffer::ByteBuffer;
|
||||
//! fn code<T: Read>(input: &mut T) -> std::io::Result<Box<[u8]>> {
|
||||
//! fn code<T: Read + ?Sized>(input: &mut T) -> std::io::Result<Box<[u8]>> {
|
||||
//! let mut buffer = ByteBuffer::new();
|
||||
//! let amount = buffer.read_from(input)?;
|
||||
//! let data = buffer.consume(amount);
|
||||
@ -151,7 +151,7 @@ impl ByteBuffer {
|
||||
/// // do something with the buffer
|
||||
/// ...
|
||||
/// ```
|
||||
pub fn read_from<T: Read>(&mut self, input: &mut T) -> Result<usize> {
|
||||
pub fn read_from<T: Read + ?Sized>(&mut self, input: &mut T) -> Result<usize> {
|
||||
let amount = input.read(self.get_free_mut_slice())?;
|
||||
self.add_size(amount);
|
||||
Ok(amount)
|
||||
|
Loading…
Reference in New Issue
Block a user