mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-08 07:48:33 +00:00
proxmox/tools/byte_buffer: improve read_from example
'norun' was not a valid attribute, so cargo doc ignored it completely instead, write a proper example that can be compiled Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
6f125bc70b
commit
78a0a0ee1d
@ -154,14 +154,15 @@ impl ByteBuffer {
|
|||||||
/// free space in the buffer) and updates its size accordingly.
|
/// free space in the buffer) and updates its size accordingly.
|
||||||
///
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
/// ```norun
|
/// ```
|
||||||
/// // create some reader
|
/// # use std::io;
|
||||||
/// let reader = ...;
|
/// # use proxmox::tools::byte_buffer::ByteBuffer;
|
||||||
///
|
/// fn code<R: io::Read>(mut reader: R) -> io::Result<()> {
|
||||||
/// let mut buf = ByteBuffer::new();
|
/// let mut buf = ByteBuffer::new();
|
||||||
/// let res = buf.read_from(reader);
|
/// let res = buf.read_from(&mut reader)?;
|
||||||
/// // do something with the buffer
|
/// // do something with the buffer
|
||||||
/// ...
|
/// Ok(())
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn read_from<T: Read + ?Sized>(&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())?;
|
let amount = input.read(self.get_free_mut_slice())?;
|
||||||
|
Loading…
Reference in New Issue
Block a user