Skip to main content

OpenObject

Struct OpenObject 

Source
pub struct OpenObject(pub Vec<(String, Value)>);
Expand description

An object with any keys and any values, kept in input order.

Tuple Fields§

§0: Vec<(String, Value)>

Trait Implementations§

Source§

impl Clone for OpenObject

Source§

fn clone(&self) -> Self

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 Debug for OpenObject

Source§

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

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

impl PartialEq for OpenObject

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Shape for OpenObject

Source§

const CLASS: Class = Class::OpenObject

The class of the shape, which decides at compile time which constraints a field of this type may carry.
Source§

const CATCH_ALL: bool = true

Whether the type collects the members of an object that no field names, so a flattened field of it types them.
Source§

fn catch_all_shape() -> Option<ShapeDef>

The shape of those members, for a type with CATCH_ALL.
Source§

fn build_rest( value: &Value, path: &mut Path, known: &[&str], ) -> Result<Self, Issues>

Converts the members of an object that are not in known, for a type with CATCH_ALL.
Source§

fn reference() -> ShapeDef

How a field of this type is described: a named type gives a reference to its definition, a built-in gives its shape inline.
Source§

fn register(_: &mut Registry)

Adds this type and every named type it refers to to registry.
Source§

fn build(value: &Value, path: &mut Path) -> Result<Self, Issues>

Converts a value that already matches this type’s shape. A mismatch means the shape and the conversion disagree, and is reported as an issue rather than a panic.
Source§

const OPTIONAL: bool = false

Whether a field of this type may be absent from its object.
Source§

const IS_OBJECT: bool = false

Whether the type is a struct, which is what a flattened field and a newtype variant of a tagged enum must be.
Source§

const KEYS: &'static [&'static str]

The keys of the object this type is, own and flattened, which a derive checks for duplicates at compile time.
Source§

fn definition() -> ShapeDef

The complete shape of this type, which for a named type is what its definition holds.
Source§

fn register_members(registry: &mut Registry)

Adds the named types this type’s fields refer to, without this type itself, for a type whose fields are merged into another object’s definition.
Source§

fn absent() -> Option<Self>

The value of a field of this type that is absent from its object, for a type that allows that.
Source§

fn definitions() -> Cow<'static, Definitions>

The definitions this type is described by.
Source§

fn from_json(value: &Value) -> Result<Self, Issues>

Validates value against this type’s shape, collecting every issue with its path, then converts it. This is what deserialising a derived type does, so deserialising is validating.
Source§

fn accepts(value: &Value) -> bool

Whether value matches this type’s shape.
Source§

impl StructuralPartialEq for OpenObject

Auto Trait Implementations§

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.