pub struct Map<T>(pub Vec<(String, T)>);Expand description
An object whose values all have one shape, kept in input order. A key called __proto__ is dropped when the map is
built, as it is when a document is read as the shape (see crate::normalise): a consumer that assigns the keys to
an object of its own would otherwise change that object’s prototype.
Tuple Fields§
§0: Vec<(String, T)>Trait Implementations§
Source§impl<T: Shape> Shape for Map<T>
impl<T: Shape> Shape for Map<T>
Source§const CLASS: Class = Class::Map
const CLASS: Class = Class::Map
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
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>
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>
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
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(registry: &mut Registry)
fn register(registry: &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>
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 IS_OBJECT: bool = false
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]
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
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)
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>
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>
fn definitions() -> Cow<'static, Definitions>
The definitions this type is described by.
impl<T: PartialEq> StructuralPartialEq for Map<T>
Auto Trait Implementations§
impl<T> Forget for Map<T>
impl<T> Freeze for Map<T>
impl<T> Move for Map<T>
impl<T> RefUnwindSafe for Map<T>
impl<T> Send for Map<T>
impl<T> Sync for Map<T>
impl<T> Unpin for Map<T>
impl<T> UnsafeUnpin for Map<T>
impl<T> UnwindSafe for Map<T>
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