diff options
author | Simon THOBY <git@nightmared.fr> | 2021-10-23 23:02:22 +0200 |
---|---|---|
committer | Simon THOBY <git@nightmared.fr> | 2021-11-02 22:18:12 +0100 |
commit | 7f7b2c3af6e6f7a596a85ada823408bdd0b02118 (patch) | |
tree | 48908226b5252d0e86758fe36d05c1491f080ac1 /rustables/src/expr/masquerade.rs | |
parent | 82ebb702c1358ac4af40c7ee43efa6f364fa6d50 (diff) |
replace Optionnals by Results for a better error propagation when deserializing expressions
Diffstat (limited to 'rustables/src/expr/masquerade.rs')
-rw-r--r-- | rustables/src/expr/masquerade.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rustables/src/expr/masquerade.rs b/rustables/src/expr/masquerade.rs index bf4e0de..40565d5 100644 --- a/rustables/src/expr/masquerade.rs +++ b/rustables/src/expr/masquerade.rs @@ -1,4 +1,4 @@ -use super::{Expression, Rule}; +use super::{DeserializationError, Expression, Rule}; use rustables_sys as sys; use std::os::raw::c_char; @@ -11,11 +11,11 @@ impl Expression for Masquerade { b"masq\0" as *const _ as *const c_char } - fn from_expr(_expr: *const sys::nftnl_expr) -> Option<Self> + fn from_expr(_expr: *const sys::nftnl_expr) -> Result<Self, DeserializationError> where Self: Sized, { - Some(Masquerade) + Ok(Masquerade) } fn to_expr(&self, _rule: &Rule) -> *mut sys::nftnl_expr { |