#[non_exhaustive]pub struct Budget {
pub max_nodes: u64,
pub max_expansion_depth: u32,
}Expand description
Limits on what one lowering may do. Untrusted trees and templates cannot exceed them; exceeding one is a reported problem or error, never a hang.
#[non_exhaustive]: start from Budget::default and assign fields.
§Examples
use lower_lang::Budget;
let mut budget = Budget::default();
budget.max_nodes = 1_000;
assert_eq!(budget.max_expansion_depth, 64);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_nodes: u64The most HIR nodes (and list entries) one lowering may build, copies
for repeated template holes included; past it lowering stops with
LowerError::NodeBudget. Default 1 << 24 (16,777,216).
max_expansion_depth: u32The deepest chain of template applications
(TemplateBuilder::apply); a deeper
one becomes an error node and an
ExpansionTooDeep problem.
Default 64.
Trait Implementations§
impl Copy for Budget
impl Eq for Budget
impl StructuralPartialEq for Budget
Auto Trait Implementations§
impl Freeze 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
Mutably borrows from an owned value. Read more