Skip to main content

PerCpuValues

Struct PerCpuValues 

Source
pub struct PerCpuValues<T: Pod> { /* private fields */ }
Expand description

A slice of per-CPU values.

Used by maps that implement per-CPU storage like PerCpuHashMap.

§Examples

use aya::maps::PerCpuValues;
use aya::util::nr_cpus;

let nr_cpus = nr_cpus().map_err(|(_, error)| error)?;
let values = PerCpuValues::try_from(vec![42u32; nr_cpus])?;

Trait Implementations§

Source§

impl<T: Debug + Pod> Debug for PerCpuValues<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Pod> Deref for PerCpuValues<T>

Source§

type Target = Box<[T]>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Borrow<MapData>, K: Pod, V: Pod> IterableMap<K, PerCpuValues<V>> for PerCpuHashMap<T, K, V>

Source§

fn map(&self) -> &MapData

Get a generic map handle
Source§

fn get(&self, key: &K) -> Result<PerCpuValues<V>, MapError>

Get the value for the provided key
Source§

impl<T: Borrow<MapData>, V: Pod> IterableMap<u32, PerCpuValues<V>> for PerCpuArray<T, V>

Source§

fn map(&self) -> &MapData

Get a generic map handle
Source§

fn get(&self, key: &u32) -> Result<PerCpuValues<V>, MapError>

Get the value for the provided key
Source§

impl<T: Pod> TryFrom<Vec<T>> for PerCpuValues<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(values: Vec<T>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<T> Freeze for PerCpuValues<T>

§

impl<T> RefUnwindSafe for PerCpuValues<T>
where T: RefUnwindSafe,

§

impl<T> Send for PerCpuValues<T>
where T: Send,

§

impl<T> Sync for PerCpuValues<T>
where T: Sync,

§

impl<T> Unpin for PerCpuValues<T>

§

impl<T> UnsafeUnpin for PerCpuValues<T>

§

impl<T> UnwindSafe for PerCpuValues<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.