diff --git a/nftnl/Cargo.toml b/nftnl/Cargo.toml index 37421c1..4ea6a18 100644 --- a/nftnl/Cargo.toml +++ b/nftnl/Cargo.toml @@ -20,7 +20,6 @@ nftnl-1-1-2 = ["nftnl-sys/nftnl-1-1-2"] [dependencies] bitflags = "1.0.4" -err-derive = "0.3.1" log = "0.4" nftnl-sys = { path = "../nftnl-sys", version = "0.6.1" } diff --git a/nftnl/src/batch.rs b/nftnl/src/batch.rs index 6748ebb..bb0e287 100644 --- a/nftnl/src/batch.rs +++ b/nftnl/src/batch.rs @@ -1,14 +1,22 @@ use crate::{MsgType, NlMsg}; +use core::fmt; use nftnl_sys::{self as sys, libc}; use std::ffi::c_void; use std::os::raw::c_char; use std::ptr; /// Error while communicating with netlink -#[derive(err_derive::Error, Debug)] -#[error(display = "Error while communicating with netlink")] +#[derive(Debug)] pub struct NetlinkError(()); +impl fmt::Display for NetlinkError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + "Error while communicating with netlink".fmt(f) + } +} + +impl std::error::Error for NetlinkError {} + /// Check if the kernel supports batched netlink messages to netfilter. pub fn batch_is_supported() -> std::result::Result { match unsafe { sys::nftnl_batch_is_supported() } {