pub enum MapValue<V> {
Single(V),
Multi(Vec<V>),
}
Expand description
Return value from eBPF maps.
Variants§
Implementations§
Source§impl<V> MapValue<V>
impl<V> MapValue<V>
Sourcepub fn into_vec(self) -> Vec<V>
pub fn into_vec(self) -> Vec<V>
Convert the map value into a Vec<V>
:
use rxdp::MapValue;
assert_eq!(MapValue::Multi(vec![1u32]).into_vec(), vec![1u32]);
assert_eq!(MapValue::Single(1u32).into_vec(), vec![1u32]);
Sourcepub fn into_single(self) -> V
pub fn into_single(self) -> V
Convert the map value into a V
. For the Multi
variant, this will take the first
element of the Vec
:
use rxdp::MapValue;
assert_eq!(MapValue::Multi(vec![1u32, 2u32]).into_single(), 1u32);
assert_eq!(MapValue::Single(1u32).into_single(), 1u32);
§Panics
Panics if len of Vec
in Multi is 0.
Trait Implementations§
impl<V: Eq> Eq for MapValue<V>
impl<V> StructuralPartialEq for MapValue<V>
Auto Trait Implementations§
impl<V> Freeze for MapValue<V>where
V: Freeze,
impl<V> RefUnwindSafe for MapValue<V>where
V: RefUnwindSafe,
impl<V> Send for MapValue<V>where
V: Send,
impl<V> Sync for MapValue<V>where
V: Sync,
impl<V> Unpin for MapValue<V>where
V: Unpin,
impl<V> UnwindSafe for MapValue<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more