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>
impl<O, K, V, H> PropertyStore<O, K, V, H>
Source§impl<O, K, V, H> PropertyStore<O, K, V, H>
impl<O, K, V, H> PropertyStore<O, K, V, H>
Sourcepub fn own(&self, owner: &O, key: &K) -> Option<&Descriptor<V, H>>
pub fn own(&self, owner: &O, key: &K) -> Option<&Descriptor<V, H>>
Returns an own descriptor without invoking it.
Sourcepub fn define(
&mut self,
owner: &O,
key: K,
descriptor: Descriptor<V, H>,
) -> Result<(), DefineError>
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.
Sourcepub fn delete(&mut self, owner: &O, key: &K) -> Result<bool, DefineError>
pub fn delete(&mut self, owner: &O, key: &K) -> Result<bool, DefineError>
Deletes an own property. Missing properties succeed.
Sourcepub fn own_keys(&self, owner: &O, enumerable_only: bool) -> Vec<K>
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.
Sourcepub 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>>
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.
Sourcepub 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>>
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>
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>
fn clone(&self) -> PropertyStore<O, K, V, H>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more