public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 4/4] proxmox/tools/byte_buffer: improve read_from example
Date: Fri, 17 Jul 2020 08:34:51 +0200	[thread overview]
Message-ID: <20200717063451.19207-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20200717063451.19207-1-d.csapak@proxmox.com>

'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>
---
 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 f01a6dd..24aec11 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<R: io::Read>(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<T: Read + ?Sized>(&mut self, input: &mut T) -> Result<usize> {
         let amount = input.read(self.get_free_mut_slice())?;
-- 
2.20.1





  parent reply	other threads:[~2020-07-17  6:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  6:34 [pbs-devel] [PATCH proxmox 1/4] proxmox/tools/websocket: introduce WebSocketError and use it Dominik Csapak
2020-07-17  6:34 ` [pbs-devel] [PATCH proxmox 2/4] proxmox/tools/websocket: improve error handling Dominik Csapak
2020-07-17  6:34 ` [pbs-devel] [PATCH proxmox 3/4] proxmox/tools/websocket: fix some clippy warnings Dominik Csapak
2020-07-17  6:34 ` Dominik Csapak [this message]
2020-07-17 10:12 ` [pbs-devel] [PATCH proxmox 1/4] proxmox/tools/websocket: introduce WebSocketError and use it Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717063451.19207-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal