Skip to main content

PerCpu

Struct PerCpu 

Source
pub struct PerCpu<T, S> { /* private fields */ }
Expand description

Typed descriptor for one symbol replicated in every runtime CPU area.

Implementations§

Source§

impl<T, S> PerCpu<T, S>
where S: PerCpuSymbol<T>,

Source

pub fn offset(&self) -> usize

Returns this symbol’s byte offset in one area.

Source

pub fn current_ptr(&self, pin: &CpuPin<'_>) -> NonNull<T>

Returns a typed pointer whose address is stable for pin.

Source

pub fn remote_ptr(&self, area: PerCpuArea) -> NonNull<T>

Returns a typed pointer in an explicitly selected remote area.

The caller remains responsible for synchronization before dereference.

Source§

impl<T, S> PerCpu<T, S>
where S: PerCpuObjectSymbol<T>,

Source

pub fn with_current_mut<R>( &self, exclusive: &ExclusiveCpu<'_>, operation: impl for<'value> FnOnce(&'value mut T) -> R, ) -> R

Mutates the current CPU’s object without allowing its borrow to escape.

Source§

impl<T, S> PerCpu<T, S>
where T: Sync, S: PerCpuObjectSymbol<T>,

Source

pub fn with_current<R>( &self, pin: &CpuPin<'_>, operation: impl for<'value> FnOnce(&'value T) -> R, ) -> R

Borrows a shared current-CPU object for one non-escaping callback.

Source§

impl<T, S> PerCpu<T, S>
where T: Sealed, S: PerCpuPrimitiveSymbol<T>,

Source

pub fn read_current(&self, pin: &CpuPin<'_>) -> T

Loads the current CPU’s atomic scalar with relaxed ordering.

Source

pub fn write_current(&self, pin: &CpuPin<'_>, value: T)

Stores the current CPU’s atomic scalar with relaxed ordering.

Auto Trait Implementations§

§

impl<T, S> Freeze for PerCpu<T, S>

§

impl<T, S> RefUnwindSafe for PerCpu<T, S>

§

impl<T, S> Send for PerCpu<T, S>

§

impl<T, S> Sync for PerCpu<T, S>

§

impl<T, S> Unpin for PerCpu<T, S>

§

impl<T, S> UnsafeUnpin for PerCpu<T, S>

§

impl<T, S> UnwindSafe for PerCpu<T, S>

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<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.