foyer_memory

Struct Record

Source
pub struct Record<E>
where E: Eviction,
{ /* private fields */ }
Expand description

Record holds the information of the cached entry.

Implementations§

Source§

impl<E> Record<E>
where E: Eviction,

Source

pub const STATE_OFFSET: usize = _

state field memory layout offset of the Record.

Source

pub fn new(data: Data<E>) -> Self

Create a record with data.

Source

pub fn empty() -> Self

Create a record without data.

Source

pub fn insert(&mut self, data: Data<E>)

Wrap the data in the record.

§Safety

Panics if the record is already wrapping data.

Source

pub fn take(&mut self) -> Data<E>

Unwrap the inner data.

§Safety

Panics if the record is not wrapping data.

Source

pub fn key(&self) -> &E::Key

Get the immutable reference of the record key.

Source

pub fn value(&self) -> &E::Value

Get the immutable reference of the record value.

Source

pub fn hint(&self) -> &E::Hint

Get the immutable reference of the record hint.

Source

pub fn hash(&self) -> u64

Get the record hash.

Source

pub fn weight(&self) -> usize

Get the record weight.

Source

pub fn state(&self) -> &UnsafeCell<E::State>

Get the record state wrapped with UnsafeCell.

§Safety
Source

pub fn set_in_eviction(&self, val: bool)

Set in eviction flag with relaxed memory order.

Source

pub fn is_in_eviction(&self) -> bool

Get in eviction flag with relaxed memory order.

Source

pub fn set_in_indexer(&self, val: bool)

Set in indexer flag with relaxed memory order.

Source

pub fn is_in_indexer(&self) -> bool

Get in indexer flag with relaxed memory order.

Source

pub fn set_ephemeral(&self, val: bool)

Set ephemeral flag with relaxed memory order.

Source

pub fn is_ephemeral(&self) -> bool

Get ephemeral flag with relaxed memory order.

Source

pub fn set_flags(&self, flags: Flags, val: bool, order: Ordering)

Set the record atomic flags.

Source

pub fn get_flags(&self, flags: Flags, order: Ordering) -> bool

Get the record atomic flags.

Source

pub fn refs(&self) -> usize

Get the atomic reference count.

Source

pub fn inc_refs(&self, val: usize) -> usize

Increase the atomic reference count.

This function returns the new reference count after the op.

Source

pub fn dec_refs(&self, val: usize) -> usize

Decrease the atomic reference count.

This function returns the new reference count after the op.

Trait Implementations§

Source§

impl<E> Debug for Record<E>
where E: Eviction,

Source§

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

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

impl<E> Send for Record<E>
where E: Eviction,

Source§

impl<E> Sync for Record<E>
where E: Eviction,

Auto Trait Implementations§

§

impl<E> !Freeze for Record<E>

§

impl<E> !RefUnwindSafe for Record<E>

§

impl<E> Unpin for Record<E>
where <E as Eviction>::State: Unpin, <E as Eviction>::Key: Unpin, <E as Eviction>::Value: Unpin, <E as Eviction>::Hint: Unpin,

§

impl<E> UnwindSafe for Record<E>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Scope for T

Source§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
Source§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
Source§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Value for T
where T: Send + Sync + 'static,