Storage

Struct Storage 

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

Type used for storing data in a affinity-aware manner.

This type is used to manage the data for each affinity, depending on the chosen strategy.

Implementations§

Source§

impl<T, S: Strategy> Storage<T, S>

Source

pub const fn new() -> Self

Creates a new empty Storage instance.

Source

pub fn replace(&mut self, affinity: PinnedAffinity, value: T) -> Option<T>

Replaces the data for the given affinity with the provided value.

Returns the previous value if it existed, otherwise returns None.

Source§

impl<T, S: Strategy> Storage<T, S>
where T: Clone,

Source

pub fn get_clone(&self, affinity: PinnedAffinity) -> Option<T>

Clone and gets the data for the given affinity if it exists. Returns None if the data does not exist for that affinity.

Trait Implementations§

Source§

impl<T: Debug, S: Debug + Strategy> Debug for Storage<T, S>

Source§

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

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

impl<T, S: Strategy> Default for Storage<T, S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

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

§

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

§

impl<T, S> Send for Storage<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for Storage<T, S>
where S: Sync, T: Sync,

§

impl<T, S> Unpin for Storage<T, S>
where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for Storage<T, S>
where S: UnwindSafe, 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<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.