Struct Cache

pub(in ::detect::cache) struct Cache(pub(in ::detect::cache) AtomicUsize);

Feature cache with capacity for size_of::<usize>() * 8 - 1 features.

Note: 0 is used to represent an uninitialized cache, and (at least) the most significant bit is set on any cache which has been initialized.

Note: we use Relaxed atomic operations, because we are only interested in the effects of operations on a single memory location. That is, we only need "modification order", and not the full-blown "happens before".

Fields

0: AtomicUsize

Implementations

impl Cache

const CAPACITY: u32 = _;
const MASK: usize = _;
const INITIALIZED_BIT: usize = _;
const fn uninitialized() -> Self

Creates an uninitialized cache.

fn test(&self, bit: u32) -> Option<bool>

Is the bit in the cache set? Returns None if the cache has not been initialized.

fn initialize(&self, value: usize) -> usize

Initializes the cache.

Auto Trait Implementations

impl !Freeze for Cache

impl RefUnwindSafe for Cache

impl Send for Cache

impl Sync for Cache

impl Unpin for Cache

impl UnsafeUnpin for Cache

impl UnwindSafe for Cache

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Cache

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Cache where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Cache

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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