#[non_exhaustive]pub enum ObjectRepr {
Plain,
Map,
Seq,
Iterable,
}
Expand description
Defines the natural representation of this object.
An ObjectRepr
is a reduced form of
ValueKind
which only contains value which can
be represented by objects. For instance an object can never be a primitive
and as such those kinds are unavailable.
The representation influences how values are serialized, stringified or what kind they report.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Plain
An object that has no reasonable representation.
Map
Represents a map or object.
- Default Render:
{key: value,...}
pairs - Collection Behavior: looks like a map, can be indexed by key, has a length
- Iteration Behavior: iterates over keys
- Serialize: Serializes as map
Seq
Represents a sequence (eg: array/list).
- Default Render:
[value,...]
- Collection Behavior: looks like a list, can be indexed by index, has a length
- Iteration Behavior: iterates over values
- Serialize: Serializes as list
Iterable
Represents a non indexable, iterable object.
- Default Render:
[value,...]
(if length is known),"<iterator>"
otherwise. - Collection Behavior: looks like a list if length is known, cannot be indexed
- Iteration Behavior: iterates over values
- Serialize: Serializes as list
Trait Implementations§
Source§impl Clone for ObjectRepr
impl Clone for ObjectRepr
Source§fn clone(&self) -> ObjectRepr
fn clone(&self) -> ObjectRepr
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ObjectRepr
impl Debug for ObjectRepr
Source§impl Hash for ObjectRepr
impl Hash for ObjectRepr
Source§impl Ord for ObjectRepr
impl Ord for ObjectRepr
Source§fn cmp(&self, other: &ObjectRepr) -> Ordering
fn cmp(&self, other: &ObjectRepr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ObjectRepr
impl PartialEq for ObjectRepr
Source§impl PartialOrd for ObjectRepr
impl PartialOrd for ObjectRepr
impl Copy for ObjectRepr
impl Eq for ObjectRepr
impl StructuralPartialEq for ObjectRepr
Auto Trait Implementations§
impl Freeze for ObjectRepr
impl RefUnwindSafe for ObjectRepr
impl Send for ObjectRepr
impl Sync for ObjectRepr
impl Unpin for ObjectRepr
impl UnwindSafe for ObjectRepr
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