Skip to main content

Crate nfs

Crate nfs 

Source
Expand description

Userspace NFS client library.

This crate talks to NFS servers directly from a Rust process. It is meant for applications that want NFS as an object/file storage backend without mounting the export into the local filesystem.

The default feature set enables blocking clients:

let mut client = nfs::v3::blocking::Client::connect("127.0.0.1:/export")?;
client.write("/hello.txt", b"hello")?;
let bytes = client.read("/hello.txt")?;
assert_eq!(bytes, b"hello");
let mut client = nfs::v4::blocking::Client::connect("127.0.0.1")?;
client.write("/export/hello.txt", b"hello")?;
let bytes = client.read("/export/hello.txt")?;
assert_eq!(bytes, b"hello");
client.shutdown()?;

§Feature flags

  • blocking: Enables synchronous clients. This is enabled by default.
  • tokio: Enables asynchronous clients backed by Tokio.
  • protocol: Exposes low-level XDR and protocol wire types for tests, custom integrations, and protocol tooling.

§API layers

Most applications should use v3::blocking::Client, v4::blocking::Client, or the corresponding Tokio clients. The raw protocol modules are intentionally kept behind the protocol feature so high-level users do not depend on unstable wire-level details.

Modules§

v3
NFSv3 client support.
v4
NFSv4.2 client support.

Structs§

AuthSys
AUTH_SYS credential used for ONC RPC calls.
RetryPolicy
Exponential backoff policy for retryable RPC/NFS responses.

Enums§

Error
Error type for transport, XDR, RPC, and NFS protocol failures.

Constants§

AUTH_SYS_MAX_GROUPS
Maximum number of auxiliary groups carried by AUTH_SYS credentials.

Type Aliases§

Result
Result type used by this crate.