pub struct Extensions(/* private fields */);Expand description
Vendor extensions: any JSON members not covered by the typed model.
This is the mechanism behind the crate’s round-trip guarantee. Unknown
members are captured here in document order (backed by IndexMap and
serde_json/preserve_order), so re-serialising a payload reproduces both
the values and their ordering.
use rutmf::core::Extensions;
let mut ext = Extensions::new();
ext.insert("x-vendor-flag", serde_json::json!(true));
assert_eq!(ext.get("x-vendor-flag"), Some(&serde_json::json!(true)));Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
pub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
Inserts an extension member, returning the previous value if any.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Removes an extension member, preserving the order of the rest.
Trait Implementations§
Source§impl Clone for Extensions
impl Clone for Extensions
Source§impl Debug for Extensions
impl Debug for Extensions
Source§impl Default for Extensions
impl Default for Extensions
Source§impl<'de> Deserialize<'de> for Extensions
impl<'de> Deserialize<'de> for Extensions
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 Extensions
Source§impl<K: Into<String>> FromIterator<(K, Value)> for Extensions
impl<K: Into<String>> FromIterator<(K, Value)> for Extensions
Source§impl<'a> IntoIterator for &'a Extensions
impl<'a> IntoIterator for &'a Extensions
Source§impl JsonSchema for Extensions
Available on crate feature schemars only.
impl JsonSchema for Extensions
Available on crate feature
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for Extensions
impl PartialEq for Extensions
Source§impl Serialize for Extensions
impl Serialize for Extensions
impl StructuralPartialEq for Extensions
Auto Trait Implementations§
impl Forget for Extensions
impl Freeze for Extensions
impl Move for Extensions
impl RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl UnsafeUnpin for Extensions
impl UnwindSafe for Extensions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.