Enum rxdp::MapValue[][src]

pub enum MapValue<V> {
    Single(V),
    Multi(Vec<V>),
}

Return value from eBPF maps.

Variants

Single(V)

Result from cpu-shared maps.

Multi(Vec<V>)

Result from per-cpu maps.

Implementations

impl<V> MapValue<V>[src]

pub fn into_vec(self) -> Vec<V>[src]

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]);

pub fn into_single(self) -> V[src]

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: Debug> Debug for MapValue<V>[src]

impl<V: Eq> Eq for MapValue<V>[src]

impl<V: PartialEq> PartialEq<MapValue<V>> for MapValue<V>[src]

impl<V> StructuralEq for MapValue<V>[src]

impl<V> StructuralPartialEq for MapValue<V>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.