#[non_exhaustive]pub enum Budget {
Show 15 variants
Delimiters,
Angles,
PrefixOperators,
ClosureBars,
ElseIf,
Recursion,
ModuleDepth,
ModulePaths,
DirectoryDepth,
FileTokens,
TotalBytes,
ItemBytes,
FactBytes,
GlobBytes,
Work,
}Expand description
A budget of a load.
The first six bound shapes that make syn recurse and are enforced by the
pre-scan before a file is parsed. The others bound the module walk,
discovery, the tokens of one file, the bytes one load reads and keeps and
the steps of glob table work one load makes. The limits live in one table,
Budget::limit, which the code and the documentation share. The token
budget, the four byte budgets and the work budget are defaults that
LoadOptions can change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Delimiters
Open delimiters ((, [, {) nested at one point.
Angles
Open < brackets nested in one delimiter level.
PrefixOperators
Consecutive prefix operators (!, -, *, &, &&).
ClosureBars
Back-to-back closure heads (|| or |...| with no body between).
ElseIf
Chained else if links.
Recursion
The nesting that the parser builds by recursion, counted additively
over every open delimiter level: the counted tokens of each open level
since its count last returned to zero, plus one for each open
delimiter. Parsing a file, reading its facts and dropping its syntax
tree take at most RECURSION_UNIT_BYTES of the parse stack for each
unit, so the limit keeps them within half of
PARSE_STACK_BYTES.
ModuleDepth
Modules nested along one path from a target root, files and inline modules together. Unlike the others it is counted by the module walk and not by the pre-scan.
ModulePaths
Module paths recorded in one load: every arrival of the module walk at a file, counted over all targets. Counted by the module walk.
DirectoryDepth
Directories nested below a root, counted by package discovery and by
the expansion of workspace.members patterns.
FileTokens
Guard token units of one file, counted by the pre-scan. A doc comment
counts as its attribute. A numeric run may fuse up to three native leaves;
PreparedSource::native_token_bound
gives a separate checked native ceiling. This bounds token structure,
not the complete native parser heap or work. PARSE_BYTES_PER_TOKEN
is an empirical reference for the measured statement shape.
TotalBytes
Bytes read in one load: every source file and manifest.
ItemBytes
Bytes the symbol index keeps: every item record and the index entries built for each module path, each shared string once, and cumulative native load traversal spills, and immutable derived glob reach/broken facts with their shared allocation header.
FactBytes
Bytes of the facts read from the files of one load, counted on the parse thread as they are built.
GlobBytes
Bytes of the glob scope tables held at once: what each module exports to glob imports, kept once for every class of importers that see the same of it and shared by them, the glob imports that read each table, and the changes waiting to be passed on as the tables grow. Also bounds retained named-import reads, queues, subscriptions and graph scratch used to settle imports, including loads without globs, scratch for impl self-type and trait-path traversal and derived glob-fact construction, and the live scratch of selected-route proofs in a query after the load.
Work
Steps of glob table work in one load, counted as they are made and
never given back: each queue, subscription and import-graph step,
derived glob-fact construction and traversal, admitted buffer growth,
each retained-read traversal, impl self-type and trait-path traversal
and its retained path segments and bytes, each glob read listed and each name gathered when a
view is built, each name a new reader is given, each reader a change is
passed on to, each glob read read again when what a module’s globs
bring in under a name is read again, each step of the search for the modules that hold an item
apart from a reading module, and each glob read a lookup of what the
globs of a module bring in looks at, with each view looked at to find
those reads, charged at the next checkpoint of the load. These are the
steps whose number grows faster than the bytes of the tables on some
shapes of globs, so the budget bounds the work of settling them
whatever their bytes. A query after the load counts the steps of its
own lookups and selected-route determinacy proofs against the same budget, with the limit
LoadOptions::max_query_work.
Implementations§
Trait Implementations§
impl Copy for Budget
impl Eq for Budget
Source§impl Ord for Budget
impl Ord for Budget
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Budget
impl PartialOrd for Budget
impl StructuralPartialEq for Budget
Auto Trait Implementations§
impl Forget for Budget
impl Freeze for Budget
impl Move for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
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.impl<T> EvidenceLease for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more