aboutsummaryrefslogtreecommitdiff
path: root/rustables/src/set.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rustables/src/set.rs')
-rw-r--r--rustables/src/set.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/rustables/src/set.rs b/rustables/src/set.rs
index d8c84d6..aef74db 100644
--- a/rustables/src/set.rs
+++ b/rustables/src/set.rs
@@ -27,9 +27,9 @@ macro_rules! nft_set {
}
pub struct Set<'a, K> {
- set: *mut sys::nftnl_set,
- table: &'a Table,
- family: ProtoFamily,
+ pub(crate) set: *mut sys::nftnl_set,
+ pub(crate) table: &'a Table,
+ pub(crate) family: ProtoFamily,
_marker: ::std::marker::PhantomData<K>,
}
@@ -130,10 +130,14 @@ impl<'a, K> Set<'a, K> {
}
}
- pub fn get_name(&self) -> &CStr {
+ pub fn get_name(&self) -> Option<&CStr> {
unsafe {
let ptr = sys::nftnl_set_get_str(self.set, sys::NFTNL_SET_NAME as u16);
- CStr::from_ptr(ptr)
+ if !ptr.is_null() {
+ Some(CStr::from_ptr(ptr))
+ } else {
+ None
+ }
}
}