Skip to main content

Limits

Struct Limits 

Source
pub struct Limits {
Show 23 fields pub max_reader_input_bytes: Option<usize>, pub max_depth: Option<usize>, pub max_nodes: Option<usize>, pub max_buffered_comment_events: Option<usize>, pub simple_key_max_lookahead: Option<usize>, pub flow_nesting_limit: Option<usize>, pub max_events: Option<usize>, pub max_aliases: Option<usize>, pub max_anchors: Option<usize>, pub max_recorded_anchor_events: Option<usize>, pub max_recorded_anchor_bytes: Option<usize>, pub max_property_expansion_depth: Option<usize>, pub max_total_property_interpolation_work: Option<usize>, pub max_inclusion_depth: Option<u32>, pub max_documents: Option<usize>, pub max_total_scalar_bytes: Option<usize>, pub max_total_comment_bytes: Option<usize>, pub max_merge_keys: Option<usize>, pub alias_anchor_min_aliases: Option<usize>, pub alias_anchor_ratio_multiplier: Option<usize>, pub max_total_replayed_events: Option<usize>, pub max_replay_stack_depth: Option<usize>, pub max_alias_expansions_per_anchor: Option<usize>,
}
Available on crate features json or toml or yaml only.
Expand description

Overrides for the limits a text is held to, one per field. None leaves the field to the next tier.

Each field is decided on its own, highest first:

  1. the call: Input::limits;
  2. with yaml, the repository: limits: in .ctl/input.yaml, installed by use_repo_limits;
  3. the process: set_default_limits, or App::input_limits;
  4. the default: ctl-core’s for the three fields every format reads, and serde-saphyr’s for the YAML-only fields.

A repository beats the CLI’s default because the user owns the repository, as a user’s environment beats the CLI’s built-in width.

The field set follows the enabled format features. max_reader_input_bytes, max_depth, and max_nodes exist in every build, and the YAML-only fields exist with yaml. Cargo enables a feature for every crate in a build, so another crate can add fields to a build of yours. Build a value with ..Limits::NONE, as in Limits { max_depth: Some(8), ..Limits::NONE }, and it compiles whatever the build enables.

enforce_alias_anchor_ratio is not here: the ratio check is one comparison after scanning, so turning it off saves nothing. It stays on; its multiplier and minimum alias count are overridable.

Fields§

§max_reader_input_bytes: Option<usize>

Bytes of input text. Also checked for text already in memory.

§max_depth: Option<usize>

Nesting of YAML sequences and mappings, of TOML arrays and tables, or of JSON arrays and objects, with the root table or container as 1. Raising it far above its default lets a deep text overflow the stack in any format, because dropping or deserializing the tree recurses once per level.

§max_nodes: Option<usize>

YAML sequences, mappings, and scalars in total; in TOML, the root table and every table, array, and value; in JSON, every array, object, and value, with no count of keys.

§max_buffered_comment_events: Option<usize>
Available on crate feature yaml only.

Comment events buffered while resolving an ambiguous entry.

§simple_key_max_lookahead: Option<usize>
Available on crate feature yaml only.

Characters scanned to resolve a simple key.

§flow_nesting_limit: Option<usize>
Available on crate feature yaml only.

Simultaneously nested flow collections.

§max_events: Option<usize>
Available on crate feature yaml only.

Parser events in total.

§max_aliases: Option<usize>
Available on crate feature yaml only.

Alias (*ref) events.

§max_anchors: Option<usize>
Available on crate feature yaml only.

Distinct anchor (&anchor) definitions.

§max_recorded_anchor_events: Option<usize>
Available on crate feature yaml only.

Event copies retained for anchors.

§max_recorded_anchor_bytes: Option<usize>
Available on crate feature yaml only.

Bytes of string payload retained for anchors.

§max_property_expansion_depth: Option<usize>
Available on crate feature yaml only.

Nested expansions in one property interpolation.

§max_total_property_interpolation_work: Option<usize>
Available on crate feature yaml only.

Bytes inspected across all property interpolation.

§max_inclusion_depth: Option<u32>
Available on crate feature yaml only.

Nesting of !include.

§max_documents: Option<usize>
Available on crate feature yaml only.

YAML documents in one text.

§max_total_scalar_bytes: Option<usize>
Available on crate feature yaml only.

Bytes of scalar text in total.

§max_total_comment_bytes: Option<usize>
Available on crate feature yaml only.

Bytes of comment text in total.

§max_merge_keys: Option<usize>
Available on crate feature yaml only.

Merge keys (<<). ctl-core refuses merge keys whatever this says.

§alias_anchor_min_aliases: Option<usize>
Available on crate feature yaml only.

Aliases allowed before the alias-to-anchor ratio applies.

§alias_anchor_ratio_multiplier: Option<usize>
Available on crate feature yaml only.

How many aliases each anchor may have once the ratio applies.

§max_total_replayed_events: Option<usize>
Available on crate feature yaml only.

Events the aliases of a text replay in total, nested aliases included.

§max_replay_stack_depth: Option<usize>
Available on crate feature yaml only.

Nesting of aliases inside aliases.

§max_alias_expansions_per_anchor: Option<usize>
Available on crate feature yaml only.

Times one anchor may be used through an alias.

Implementations§

Source§

impl Limits

Source

pub const NONE: Self

No overrides: every field falls through.

Source

pub fn or(self, lower: &Self) -> Self

self, with each unset field taken from lower.

Source§

impl Limits

Source

pub const DEFAULT_MAX_READER_INPUT_BYTES: usize

max_reader_input_bytes when no tier sets it: 256 MiB.

Source

pub const DEFAULT_MAX_DEPTH: usize = 64

max_depth when no tier sets it.

Source

pub const DEFAULT_MAX_NODES: usize = 250_000

max_nodes when no tier sets it.

Trait Implementations§

Source§

impl Clone for Limits

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Limits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Limits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Limits
where Limits: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Limits

Source§

impl PartialEq for Limits

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Limits

Auto Trait Implementations§

§

impl Forget for Limits

§

impl Freeze for Limits

§

impl Move for Limits

§

impl RefUnwindSafe for Limits

§

impl Send for Limits

§

impl Sync for Limits

§

impl Unpin for Limits

§

impl UnsafeUnpin for Limits

§

impl UnwindSafe for Limits

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, O> Matches<O> for T
where T: PartialEq<O>,

Source§

fn validate_matches(&self, other: &O) -> bool

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.