aboutsummaryrefslogtreecommitdiff
path: root/rustables/src/expr/cmp.rs
diff options
context:
space:
mode:
authorSimon THOBY <git@nightmared.fr>2021-10-21 22:37:23 +0200
committerSimon THOBY <git@nightmared.fr>2021-11-02 22:17:44 +0100
commit4dc522ae121ef9c8379b9efe248d0dc9625812cb (patch)
tree24d7df36d4be647f7abbc386d112fd972614858d /rustables/src/expr/cmp.rs
parent180c4d5c8ff86836e0f440d7d0540c02c168c4bf (diff)
Extend the `Expression` trait to allow for "deserialization"
Diffstat (limited to 'rustables/src/expr/cmp.rs')
-rw-r--r--rustables/src/expr/cmp.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/rustables/src/expr/cmp.rs b/rustables/src/expr/cmp.rs
index 5c56492..b14aa1d 100644
--- a/rustables/src/expr/cmp.rs
+++ b/rustables/src/expr/cmp.rs
@@ -55,9 +55,13 @@ impl<T: ToSlice> Cmp<T> {
}
impl<T: ToSlice> Expression for Cmp<T> {
+ fn get_raw_name() -> *const c_char {
+ b"cmp\0" as *const _ as *const c_char
+ }
+
fn to_expr(&self, _rule: &Rule) -> *mut sys::nftnl_expr {
unsafe {
- let expr = try_alloc!(sys::nftnl_expr_alloc(b"cmp\0" as *const _ as *const c_char));
+ let expr = try_alloc!(sys::nftnl_expr_alloc(Self::get_raw_name()));
let data = self.data.to_slice();
trace!("Creating a cmp expr comparing with data {:?}", data);