#[non_exhaustive]
pub enum ObjectKind<'a> { Plain, Seq(&'a dyn SeqObject), Struct(&'a dyn StructObject), }
Expand description

A kind defines the object’s behavior.

When a dynamic Object is implemented, it can be of one of the kinds here. The default behavior will be a Plain object which doesn’t do much other than that it can be printed. For an object to turn into a struct or sequence the necessary kind has to be returned with a pointer to itself.

Today object’s can have the behavior of structs and sequences but this might expand in the future. It does mean that not all types of values can be represented by objects.

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

This object is a plain object.

Such an object has no attributes but it might be callable and it can be stringified. When serialized it’s serialized in it’s stringified form.

§

Seq(&'a dyn SeqObject)

This object is a sequence.

Requires that the object implements SeqObject.

§

Struct(&'a dyn StructObject)

This object is a struct (map with string keys).

Requires that the object implements StructObject.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ObjectKind<'a>

§

impl<'a> Send for ObjectKind<'a>

§

impl<'a> Sync for ObjectKind<'a>

§

impl<'a> Unpin for ObjectKind<'a>

§

impl<'a> !UnwindSafe for ObjectKind<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.