Crates.io | nfs3_client |
lib.rs | nfs3_client |
version | 0.7.0 |
created_at | 2025-02-22 19:26:39.314466+00 |
updated_at | 2025-07-26 16:37:31.571691+00 |
description | Provides an implementation of NFS3 client |
homepage | https://github.com/Vaiz/nfs3 |
repository | https://github.com/Vaiz/nfs3 |
max_upload_size | |
id | 1565706 |
size | 87,127 |
nfs3_client
nfs3_client
is a Rust crate that provides an asynchronous client implementation for interacting with NFSv3
servers. It includes functionality for connecting to NFS servers, performing various NFS operations, and handling the underlying RPC communication.
This crate supports multiple async runtimes via feature flags:
tokio
- Support for Tokio runtimesmol
- Support for Smol runtimeuse nfs3_client::tokio::TokioConnector;
use nfs3_client::Nfs3ConnectionBuilder;
use nfs3_types::nfs3;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut connection = Nfs3ConnectionBuilder::new(TokioConnector, "127.0.0.1", "/")
.mount()
.await?;
let root = connection.root_nfs_fh3();
println!("Calling readdir");
let readdir = connection
.readdir(&nfs3::READDIR3args {
dir: root,
cookie: 0,
cookieverf: nfs3::cookieverf3::default(),
count: 128 * 1024 * 1024,
})
.await?;
println!("{readdir:?}");
connection.unmount().await?;
Ok(())
}
use nfs3_client::smol::SmolConnector;
use nfs3_client::Nfs3ConnectionBuilder;
use nfs3_client::nfs3_types::nfs3;
fn main() -> Result<(), Box<dyn std::error::Error>> {
smol::block_on(async {
let mut connection = Nfs3ConnectionBuilder::new(SmolConnector, "127.0.0.1", "/")
.mount()
.await?;
let root = connection.root_nfs_fh3();
println!("Calling readdir");
let readdir = connection
.readdir(&nfs3::READDIR3args {
dir: root.clone(),
cookie: 0,
cookieverf: nfs3::cookieverf3::default(),
count: 128 * 1024 * 1024,
})
.await?;
println!("{readdir:?}");
connection.unmount().await?;
Ok(())
})
}