Skip to main content

PropertyStore

Struct PropertyStore 

Source
pub struct PropertyStore<O, K, V, H> { /* private fields */ }
Expand description

Ordered own-property records keyed by caller-owned object identities.

This store deliberately has no parent pointer and no built-in traversal or precedence rule. Callers supply an already-policy-ordered owner slice for every inherited operation.

Implementations§

Source§

impl<O, K, V, H> PropertyStore<O, K, V, H>

Source

pub const fn new() -> Self

Creates an empty property store without imposing Default on its caller-owned identity, key, value, or hook types.

Source§

impl<O, K, V, H> PropertyStore<O, K, V, H>
where O: Clone + Eq + Hash, K: Clone + Eq + Hash, V: Clone + PartialEq, H: Clone + PartialEq,

Source

pub fn own(&self, owner: &O, key: &K) -> Option<&Descriptor<V, H>>

Returns an own descriptor without invoking it.

Source

pub fn define( &mut self, owner: &O, key: K, descriptor: Descriptor<V, H>, ) -> Result<(), DefineError>

Defines an own property, retaining its original key position on update.

Source

pub fn delete(&mut self, owner: &O, key: &K) -> Result<bool, DefineError>

Deletes an own property. Missing properties succeed.

Source

pub fn own_keys(&self, owner: &O, enumerable_only: bool) -> Vec<K>

Returns own keys in stable definition order, optionally filtering out non-enumerable records. Delete followed by define appends a fresh key.

Source

pub fn get<E>( &self, owners: &[O], receiver: &O, key: &K, context: &mut AccessContext<O, K>, hooks: &mut impl PropertyHook<O, K, V, H, Error = E>, ) -> Result<Option<V>, AccessError<E>>

Reads along an explicitly supplied owner order. Duplicate owners are skipped, making cyclic caller-produced orders safe.

Source

pub fn set<E>( &mut self, owners: &[O], receiver: &O, key: &K, value: V, context: &mut AccessContext<O, K>, hooks: &mut impl PropertyHook<O, K, V, H, Error = E>, ) -> Result<bool, AccessError<E>>

Assigns through the first descriptor in an explicit owner order. Writable data is updated on its owner; accessor setters receive the original receiver. Missing and read-only properties return Ok(false).

Trait Implementations§

Source§

impl<O: Clone, K: Clone, V: Clone, H: Clone> Clone for PropertyStore<O, K, V, H>

Source§

fn clone(&self) -> PropertyStore<O, K, V, H>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<O: Debug, K: Debug, V: Debug, H: Debug> Debug for PropertyStore<O, K, V, H>

Source§

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

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

impl<O: Default, K: Default, V: Default, H: Default> Default for PropertyStore<O, K, V, H>

Source§

fn default() -> PropertyStore<O, K, V, H>

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

Auto Trait Implementations§

§

impl<O, K, V, H> Freeze for PropertyStore<O, K, V, H>

§

impl<O, K, V, H> RefUnwindSafe for PropertyStore<O, K, V, H>

§

impl<O, K, V, H> Send for PropertyStore<O, K, V, H>
where O: Send, K: Send, V: Send, H: Send,

§

impl<O, K, V, H> Sync for PropertyStore<O, K, V, H>
where O: Sync, K: Sync, V: Sync, H: Sync,

§

impl<O, K, V, H> Unpin for PropertyStore<O, K, V, H>
where O: Unpin, K: Unpin, V: Unpin, H: Unpin,

§

impl<O, K, V, H> UnsafeUnpin for PropertyStore<O, K, V, H>

§

impl<O, K, V, H> UnwindSafe for PropertyStore<O, K, V, H>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.