Skip to main content

SharedKeyDefault

Struct SharedKeyDefault 

Source
pub struct SharedKeyDefault<Key, Seed> { /* private fields */ }
Expand description

Attaches a repeatable default without changing the base key’s identity.

Implementations§

Source§

impl<Key, Seed> SharedKeyDefault<Key, Seed>

Source

pub const fn new(key: Key, seed: Seed) -> Self

Associates a base key with a seed closure without invoking it.

Source

pub fn into_key(self) -> Key

Removes the default for require, key replacement or an overriding seed.

§Panics

Propagates a destructor panic from the unused seed’s captures. The key is still owned locally and is dropped if that cleanup unwinds.

Source§

impl<Key: SharedReaderKey, Seed: Fn() -> Key::Value> SharedKeyDefault<Key, Seed>

Source

pub fn initial_value(&self) -> Key::Value

Evaluates the default on every direct access, independently of cache hits.

Trait Implementations§

Source§

impl<Key, Seed> Debug for SharedKeyDefault<Key, Seed>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Key, Seed> Forget for SharedKeyDefault<Key, Seed>

§

impl<Key, Seed> Freeze for SharedKeyDefault<Key, Seed>
where Key: Freeze, Seed: Freeze,

§

impl<Key, Seed> Move for SharedKeyDefault<Key, Seed>

§

impl<Key, Seed> RefUnwindSafe for SharedKeyDefault<Key, Seed>
where Key: RefUnwindSafe, Seed: RefUnwindSafe,

§

impl<Key, Seed> Send for SharedKeyDefault<Key, Seed>
where Seed: Send, Key: Send,

§

impl<Key, Seed> Sync for SharedKeyDefault<Key, Seed>
where Seed: Sync, Key: Sync,

§

impl<Key, Seed> Unpin for SharedKeyDefault<Key, Seed>
where Seed: Unpin, Key: Unpin,

§

impl<Key, Seed> UnsafeUnpin for SharedKeyDefault<Key, Seed>
where Key: UnsafeUnpin, Seed: UnsafeUnpin,

§

impl<Key, Seed> UnwindSafe for SharedKeyDefault<Key, Seed>
where Key: UnwindSafe, Seed: 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.