pub struct MetadataLimits { /* private fields */ }Expand description
Domain-specific metadata limits composed with a shared JSON profile.
MetadataLimits deliberately keeps metadata-entry, schema-field, and key
bounds separate from generic JSON map/key accounting. This preserves the
protocol’s domain limits while the directional JSON limit types handle
document traversal, payload lengths, and complete input/output bytes.
§Examples
use qubit_metadata::MetadataLimits;
let limits = MetadataLimits::builder().max_key_bytes(128).build()?;
assert_eq!(limits.max_key_bytes(), 128);Implementations§
Source§impl MetadataLimits
impl MetadataLimits
Sourcepub fn builder() -> MetadataLimitsBuilder
pub fn builder() -> MetadataLimitsBuilder
Creates a builder with the default JSON profile and domain limits.
§Returns
A builder initialized with the protocol defaults.
Sourcepub const fn json_decode(&self) -> JsonDecodeLimits
pub const fn json_decode(&self) -> JsonDecodeLimits
Returns the JSON budgets used to decode an untrusted document.
The returned value is copied and can be used to inspect the profile without changing this limits value.
§Returns
The decoding profile stored in this value.
Sourcepub const fn json_encode(&self) -> JsonEncodeLimits
pub const fn json_encode(&self) -> JsonEncodeLimits
Returns the JSON budgets used to encode a document.
The returned value is copied and can be used to inspect the profile without changing this limits value.
§Returns
The encoding profile stored in this value.
Sourcepub const fn max_metadata_entries(&self) -> usize
pub const fn max_metadata_entries(&self) -> usize
Returns the maximum number of entries accepted in a metadata map.
This domain-specific bound is independent of generic JSON map accounting.
§Returns
The metadata-entry limit stored in this value.
Sourcepub const fn max_schema_fields(&self) -> usize
pub const fn max_schema_fields(&self) -> usize
Returns the maximum number of fields accepted in a metadata schema.
This domain-specific bound is independent of generic JSON traversal limits.
§Returns
The schema-field limit stored in this value.
Sourcepub const fn max_key_bytes(&self) -> usize
pub const fn max_key_bytes(&self) -> usize
Returns the maximum UTF-8 byte length accepted for one key.
The byte count applies to metadata and schema keys and is distinct from the generic JSON key budget.
§Returns
The key-byte limit stored in this value.