From 78a0a0ee1d218829de80283eed091897206f4b26 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 17 Jul 2020 14:17:10 +0200 Subject: [PATCH] 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 Signed-off-by: Wolfgang Bumiller --- proxmox/src/tools/byte_buffer.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/proxmox/src/tools/byte_buffer.rs b/proxmox/src/tools/byte_buffer.rs index f01a6dd5..24aec11d 100644 --- a/proxmox/src/tools/byte_buffer.rs +++ b/proxmox/src/tools/byte_buffer.rs @@ -154,14 +154,15 @@ impl ByteBuffer { /// free space in the buffer) and updates its size accordingly. /// /// Example: - /// ```norun - /// // create some reader - /// let reader = ...; - /// - /// let mut buf = ByteBuffer::new(); - /// let res = buf.read_from(reader); - /// // do something with the buffer - /// ... + /// ``` + /// # use std::io; + /// # use proxmox::tools::byte_buffer::ByteBuffer; + /// fn code(mut reader: R) -> io::Result<()> { + /// let mut buf = ByteBuffer::new(); + /// let res = buf.read_from(&mut reader)?; + /// // do something with the buffer + /// Ok(()) + /// } /// ``` pub fn read_from(&mut self, input: &mut T) -> Result { let amount = input.read(self.get_free_mut_slice())?;