Skip to content

Commit

Permalink
docs(autonomi): add feature flag note to doc items
Browse files Browse the repository at this point in the history
  • Loading branch information
b-zee committed Dec 4, 2024
1 parent 7924f23 commit 893d301
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autonomi/README_WASM.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ To run a WASM test
Example:

```sh
ANT_PEERS=/ip4/<ip>/tcp/<port>/ws/p2p/<peer ID> wasm-pack test --release --firefox autonomi --features=data,files --test wasm -- put
ANT_PEERS=/ip4/<ip>/tcp/<port>/ws/p2p/<peer ID> wasm-pack test --release --firefox autonomi --features=files --test wasm -- put
```

### Test from JS in the browser
Expand Down
3 changes: 0 additions & 3 deletions autonomi/src/client/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub static FILE_UPLOAD_BATCH_SIZE: LazyLock<usize> = LazyLock::new(|| {
});

/// Errors that can occur during the file upload operation.
#[cfg(feature = "fs")]
#[derive(Debug, thiserror::Error)]
pub enum UploadError {
#[error("Failed to recursively traverse directory")]
Expand All @@ -53,7 +52,6 @@ pub enum UploadError {
Deserialization(#[from] rmp_serde::decode::Error),
}

#[cfg(feature = "fs")]
/// Errors that can occur during the download operation.
#[derive(Debug, thiserror::Error)]
pub enum DownloadError {
Expand All @@ -63,7 +61,6 @@ pub enum DownloadError {
IoError(#[from] std::io::Error),
}

#[cfg(feature = "fs")]
/// Errors that can occur during the file cost calculation.
#[derive(Debug, thiserror::Error)]
pub enum FileCostError {
Expand Down
8 changes: 8 additions & 0 deletions autonomi/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

// Optionally enable nightly `doc_cfg`. Allows items to be annotated, e.g.: "Available on crate feature X only".
#![cfg_attr(docsrs, feature(doc_cfg))]

pub mod address;
pub mod payment;

Expand All @@ -14,14 +17,19 @@ pub mod archive_private;
pub mod data;
pub mod data_private;
#[cfg(feature = "external-signer")]
#[cfg_attr(docsrs, doc(cfg(feature = "external-signer")))]
pub mod external_signer;
#[cfg(feature = "fs")]
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
pub mod fs;
#[cfg(feature = "fs")]
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
pub mod fs_private;
#[cfg(feature = "registers")]
#[cfg_attr(docsrs, doc(cfg(feature = "registers")))]
pub mod registers;
#[cfg(feature = "vault")]
#[cfg_attr(docsrs, doc(cfg(feature = "vault")))]
pub mod vault;

#[cfg(target_arch = "wasm32")]
Expand Down
25 changes: 25 additions & 0 deletions autonomi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@

//! Connect to and build on the Autonomi network.
//!
//! # Example
//!
//! ```rust
//! use autonomi::{Bytes, Client, Wallet};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Client::connect(&["/ip4/127.0.0.1/udp/1234/quic-v1".parse()?]).await?;
//!
//! // Default wallet of testnet.
//! let key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
//! let wallet = Wallet::new_from_private_key(Default::default(), key)?;
//!
//! // Put and fetch data.
//! let data_addr = client.data_put(Bytes::from("Hello, World"), (&wallet).into()).await?;
//! let _data_fetched = client.data_get(data_addr).await?;
//!
//! // Put and fetch directory from local file system.
//! let dir_addr = client.dir_upload("files/to/upload".into(), &wallet).await?;
//! client.dir_download(dir_addr, "files/downloaded".into()).await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Data types
//!
//! This API gives access to two fundamental types on the network: chunks and
Expand Down

0 comments on commit 893d301

Please sign in to comment.