pub struct Extensions(pub Map<Value>);Expand description
Implementation-defined fields attached to an object.
Most objects in the model carry one of these flattened into their serialization. Two do not, because the specification forbids it: the Reference Object and the Security Requirement Object.
Keys are not checked on construction — crate::validate reports
non-conforming names, so that a description parsed from an external source
round-trips rather than being silently rewritten.
Tuple Fields§
§0: Map<Value>Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Option<Value>
pub fn insert( &mut self, key: impl Into<String>, value: impl Into<Value>, ) -> Option<Value>
Inserts an extension, returning the previous value for that key.
The x- prefix is not added for you; pass the full field name.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Removes an extension, returning its value.
Removal preserves the order of the remaining entries, which is what keeps an emitted description byte-stable across an edit. Owning that choice here is the point: a caller reaching through to the map would have to make it, and could make it differently each time.
Sourcepub fn is_valid_name(name: &str) -> bool
pub fn is_valid_name(name: &str) -> bool
Returns true when name is a well-formed extension field name that is
not reserved by the OpenAPI Initiative.
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>,
impl Eq for Extensions
Source§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 Freeze 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
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
key and return true if they are equal.