aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d02c785..044030f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -78,25 +78,11 @@ extern crate log;
pub mod sys;
use libc;
-use std::{convert::TryFrom, ffi::c_void, ops::Deref};
-
-macro_rules! try_alloc {
- ($e:expr) => {{
- let ptr = $e;
- if ptr.is_null() {
- // OOM, and the tried allocation was likely very small,
- // so we are in a very tight situation. We do what libstd does, aborts.
- std::process::abort();
- }
- ptr
- }};
-}
+use std::convert::TryFrom;
mod batch;
pub use batch::{default_batch_page_size, Batch};
-pub mod expr;
-
mod table;
pub use table::list_tables;
pub use table::Table;
@@ -117,6 +103,8 @@ mod rule;
pub use rule::list_rules_for_chain;
pub use rule::Rule;
+pub mod expr;
+
//mod rule_methods;
//pub use rule_methods::{iface_index, Error as MatchError, Protocol, RuleMethods};
@@ -155,6 +143,12 @@ pub enum ProtocolFamily {
DecNet = libc::NFPROTO_DECNET,
}
+impl Default for ProtocolFamily {
+ fn default() -> Self {
+ Self::Unspec
+ }
+}
+
impl TryFrom<i32> for ProtocolFamily {
type Error = DecodeError;
fn try_from(value: i32) -> Result<Self, Self::Error> {