pub enum AccessKind {
Field,
Key,
Index,
KeyedItem,
}Expand description
Describes how a reflected value can be accessed.
§Example
let value = Object::new(Book { title: "Rust" });
assert_eq!(value.access_kind(), Some(AccessKind::Field));Variants§
Field
Access named fields through ObjectRef::field and
ObjectRef::field_names. Reported by Reflect::Struct and by enums
whose active variant has named fields or is a unit variant.
Key
Access values by key and enumerate keys and length via ObjectRef::key,
ObjectRef::keys and ObjectRef::len. Reported by Reflect::Map.
Index
Access values by index and report their length via ObjectRef::item and
ObjectRef::len. Reported by Reflect::Sequence, Reflect::Tuple
and enums whose active variant is a tuple variant.
KeyedItem
Access items by key or by index via ObjectRef::key and ObjectRef::item,
and enumerate keys and length via ObjectRef::keys and ObjectRef::len.
Each key is unique. Reported by Reflect::KeyedSequence.
Trait Implementations§
Source§impl Clone for AccessKind
impl Clone for AccessKind
impl Copy for AccessKind
Source§impl Debug for AccessKind
impl Debug for AccessKind
impl Eq for AccessKind
Source§impl PartialEq for AccessKind
impl PartialEq for AccessKind
impl StructuralPartialEq for AccessKind
Auto Trait Implementations§
impl Freeze for AccessKind
impl RefUnwindSafe for AccessKind
impl Send for AccessKind
impl Sync for AccessKind
impl Unpin for AccessKind
impl UnsafeUnpin for AccessKind
impl UnwindSafe for AccessKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more