libnbd-rust(3)

πŸ“¦ version 1.24.4, in arch rolling

okay so bestie, welcome to libnbd-rust(3) from the LIBNBD manual fam β€” this is literally the page that explains how to use libnbd from Rust, and yes, it’s giving main character energy. πŸ’…βœ¨

🌸 NAME 🌸

libnbd-rust β€” how to use libnbd from Rust, no cap.

✨ SYNOPSIS ✨

let nbd = libnbd::Handle::new().unwrap();
nbd.connect_uri("nbd://localhost").unwrap();
let size = nbd.get_size().unwrap();
println!("{size} bytes");

In Cargo.toml add:

[dependencies]
libnbd = VERSION | { path = "libnbd/rust" }

πŸ¦‹ DESCRIPTION πŸ¦‹

This manual page documents how to use libnbd to access Network Block Device (NBD) servers from the Rust programming language. πŸ¦€βœ¨

The Rust bindings work very similarly to the C bindings, so bestie you should start by reading libnbd(3) first. It’s the blueprint.

There is also a higher level asynchronous API using Tokio β€” she’s async, she’s iconic, she’s doing the most.

If you build libnbd from source, the main documentation can be found in libnbd/rust/target/doc/libnbd/index.html.

For the ordinary interface, start by reading the documentation for Handle. For the higher level asynchronous API, start by reading AsyncHandle. Two doors, both slay. πŸšͺ✨

libnbd-sys is a very low level wrapper around the libnbd API which should not be used directly.

⚠️ warning bestie: libnbd-sys is giving β€œinternal plumbing, do not touch” energy. Use it directly? No. Absolutely not. πŸ™ˆ

πŸ’– EXAMPLES πŸ’–

This directory contains examples written in Rust:

https://gitlab.com/nbdkit/libnbd/tree/master/rust/examples

Go look, it’s a whole mood. πŸ“

πŸŽ€ SEE ALSO πŸŽ€

libnbd(3) β€” that’s the one to read first, periodt.

πŸ‘‘ AUTHORS πŸ‘‘

Tage Johansson

Copyright Tage Johansson

πŸ’… LICENSE πŸ’…

okay legal bestie moment, here are the license deets exactly as they need to be:

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

okay that’s the whole page, bestie β€” cute little footer sign-off time: this came from source/version libnbd-1.24.4, dated 2026-10-13. periodt. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from