pub struct ExtensionsV1(/* private fields */);Expand description
Ordered, bounded storage for additive top-level V1 fields.
The map is intentionally a newtype instead of an alias so both deserialization and programmatic insertion enforce the same bounds. Each owning DTO applies its own reserved-field validation when it validates the decoded value.
Implementations§
Source§impl ExtensionsV1
impl ExtensionsV1
Sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: Value,
) -> Result<Option<Value>, ValidationError>
pub fn insert( &mut self, key: impl Into<String>, value: Value, ) -> Result<Option<Value>, ValidationError>
Add one extension after validating its key and JSON value.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check whether one additive field is retained.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &Value)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &Value)>
Iterate over retained additive fields in lexical order.
Sourcepub fn into_inner(self) -> BTreeMap<String, Value>
pub fn into_inner(self) -> BTreeMap<String, Value>
Consume the wrapper and return the validated map.
Trait Implementations§
Source§impl Clone for ExtensionsV1
impl Clone for ExtensionsV1
Source§impl Debug for ExtensionsV1
impl Debug for ExtensionsV1
Source§impl Default for ExtensionsV1
impl Default for ExtensionsV1
Source§impl<'de> Deserialize<'de> for ExtensionsV1
impl<'de> Deserialize<'de> for ExtensionsV1
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ExtensionsV1
Source§impl Index<&str> for ExtensionsV1
impl Index<&str> for ExtensionsV1
Source§impl PartialEq for ExtensionsV1
impl PartialEq for ExtensionsV1
Source§impl Serialize for ExtensionsV1
impl Serialize for ExtensionsV1
impl StructuralPartialEq for ExtensionsV1
Auto Trait Implementations§
impl Freeze for ExtensionsV1
impl RefUnwindSafe for ExtensionsV1
impl Send for ExtensionsV1
impl Sync for ExtensionsV1
impl Unpin for ExtensionsV1
impl UnsafeUnpin for ExtensionsV1
impl UnwindSafe for ExtensionsV1
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