From 90b15fb2d723ed0a9f0d8b9327610d4766731f3e Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Wed, 4 Dec 2024 11:31:51 +0100 Subject: [PATCH] docs(autonomi): add archive_get rustdoc example --- autonomi/src/client/archive.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/autonomi/src/client/archive.rs b/autonomi/src/client/archive.rs index 8eb23bb686..8810c0809d 100644 --- a/autonomi/src/client/archive.rs +++ b/autonomi/src/client/archive.rs @@ -146,6 +146,19 @@ impl Archive { impl Client { /// Fetch an archive from the network + /// + /// # Example + /// + /// ```no_run + /// # use autonomi::client::{Client, archive::ArchiveAddr}; + /// # #[tokio::main] + /// # async fn main() -> Result<(), Box> { + /// # let peers = ["/ip4/127.0.0.1/udp/1234/quic-v1".parse()?]; + /// let client = Client::connect(&peers).await?; + /// let archive = client.archive_get(ArchiveAddr::random(&mut rand::thread_rng())).await?; + /// # Ok(()) + /// # } + /// ``` pub async fn archive_get(&self, addr: ArchiveAddr) -> Result { let data = self.data_get(addr).await?; Ok(Archive::from_bytes(data)?)