macro_rules! plugin { ( $cls:path { $($feat:ident),* } ) => { ... }; }
Expand description
Register your plugin with NBDKit.
Declare which optional methods it supports by supplying each as an argument.
Examples
struct MyPlugin{
// ...
}
impl Server for MyPlugin {
fn get_size(&self) -> Result<i64> {
// ...
}
fn name() -> &'static str {
"my_plugin"
}
fn open(_readonly: bool) -> Result<Box<dyn Server>> {
// ...
}
fn read_at(&self, buf: &mut [u8], offs: u64) -> Result<()> {
// ...
}
fn write_at(&self, buf: &[u8], offs: u64, flags: Flags) -> Result<()> {
// ...
}
}
plugin!(MyPlugin {write_at});