libnbd-rust(3)
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 π
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
- arch rolling: libnbd 1.24.4-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms