pub struct Extensions { /* private fields */ }Expand description
A sorted, unique, resource-bounded extension map.
Deserializing an extension never grants authority or activates behavior. Adapters negotiate and register supported keys separately, schema-validate every semantically used value, and either reject or retain unknown opaque values according to their protocol profile. Serialization order is the exact byte order of canonical key text.
Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn try_new<I>(entries: I) -> Result<Self, ExtensionsError>
pub fn try_new<I>(entries: I) -> Result<Self, ExtensionsError>
Constructs a map under the immutable v1 hard ceiling.
§Errors
Returns ExtensionsError for duplicate keys or a count, key, nested
JSON, compact-size, or internal encoding violation.
Sourcepub fn try_new_with_limits<I>(
entries: I,
limits: ExtensionLimits,
) -> Result<Self, ExtensionsError>
pub fn try_new_with_limits<I>( entries: I, limits: ExtensionLimits, ) -> Result<Self, ExtensionsError>
Constructs a map under an explicitly narrowed limit profile.
§Errors
Returns ExtensionsError for duplicate keys or a count, key, nested
JSON, compact-size, or internal encoding violation.
Sourcepub fn try_restrict(
self,
limits: ExtensionLimits,
) -> Result<Self, ExtensionsError>
pub fn try_restrict( self, limits: ExtensionLimits, ) -> Result<Self, ExtensionsError>
Revalidates an existing map under a profile that may be narrower.
§Errors
Returns ExtensionsError when existing entries exceed the profile.
Sourcepub const fn compact_bytes(&self) -> usize
pub const fn compact_bytes(&self) -> usize
Returns the exact compact JSON byte length of the complete map.
Sourcepub fn get(&self, key: &str) -> Option<&ExtensionValue>
pub fn get(&self, key: &str) -> Option<&ExtensionValue>
Looks up one canonical namespace key.
Sourcepub fn iter(&self) -> Iter<'_, ExtensionKey, ExtensionValue> ⓘ
pub fn iter(&self) -> Iter<'_, ExtensionKey, ExtensionValue> ⓘ
Returns entries in canonical key-byte order.
Sourcepub fn into_entries(self) -> Vec<(ExtensionKey, ExtensionValue)>
pub fn into_entries(self) -> Vec<(ExtensionKey, ExtensionValue)>
Consumes the map into entries in canonical key-byte order.
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<'a> IntoIterator for &'a Extensions
impl<'a> IntoIterator for &'a Extensions
Source§type Item = (&'a ExtensionKey, &'a ExtensionValue)
type Item = (&'a ExtensionKey, &'a ExtensionValue)
Source§type IntoIter = Iter<'a, ExtensionKey, ExtensionValue>
type IntoIter = Iter<'a, ExtensionKey, ExtensionValue>
Source§impl JsonSchema for Extensions
impl JsonSchema for Extensions
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more