pub struct DeclarationLimits { /* private fields */ }Expand description
The memory, instruction and source-walk ceilings for evaluating one build file.
The memory ceiling bounds the Lua heap, and it is also the byte budget for the declarations the
file stages outside that heap. The walk ceiling bounds the directory entries the host visits for
buildl.sources, counted across every call the file makes.
§Examples
use std::num::NonZeroU64;
use buildl_lua::DeclarationLimits;
let defaults = DeclarationLimits::default();
assert_eq!(defaults.memory_bytes().get(), 16 * 1024 * 1024);
assert_eq!(defaults.instructions().get(), 10_000_000);
assert_eq!(defaults.walk_entries().get(), 100_000);
let tight = DeclarationLimits::new(NonZeroU64::MIN, NonZeroU64::MIN)
.with_walk_entries(NonZeroU64::MIN);
assert_eq!(tight.memory_bytes().get(), 1);
assert_eq!(tight.walk_entries().get(), 1);Implementations§
Source§impl DeclarationLimits
impl DeclarationLimits
Sourcepub const fn new(memory_bytes: NonZeroU64, instructions: NonZeroU64) -> Self
pub const fn new(memory_bytes: NonZeroU64, instructions: NonZeroU64) -> Self
Limits of memory_bytes bytes and instructions Lua VM instructions per build file, with
the default walk ceiling.
Sourcepub const fn with_walk_entries(self, walk_entries: NonZeroU64) -> Self
pub const fn with_walk_entries(self, walk_entries: NonZeroU64) -> Self
The same limits with a ceiling of walk_entries directory entries per build file.
Sourcepub const fn walk_entries(&self) -> NonZeroU64
pub const fn walk_entries(&self) -> NonZeroU64
The ceiling on directory entries the buildl.sources walk may visit, across all its calls
in one build file.
Sourcepub const fn memory_bytes(&self) -> NonZeroU64
pub const fn memory_bytes(&self) -> NonZeroU64
The memory ceiling, and staging budget, in bytes.
Sourcepub const fn instructions(&self) -> NonZeroU64
pub const fn instructions(&self) -> NonZeroU64
The instruction ceiling.
Trait Implementations§
Source§impl Clone for DeclarationLimits
impl Clone for DeclarationLimits
impl Copy for DeclarationLimits
Source§impl Debug for DeclarationLimits
impl Debug for DeclarationLimits
Source§impl Default for DeclarationLimits
impl Default for DeclarationLimits
impl Eq for DeclarationLimits
Source§impl PartialEq for DeclarationLimits
impl PartialEq for DeclarationLimits
impl StructuralPartialEq for DeclarationLimits
Auto Trait Implementations§
impl Forget for DeclarationLimits
impl Freeze for DeclarationLimits
impl Move for DeclarationLimits
impl RefUnwindSafe for DeclarationLimits
impl Send for DeclarationLimits
impl Sync for DeclarationLimits
impl Unpin for DeclarationLimits
impl UnsafeUnpin for DeclarationLimitswhere
NonZeroU64Inner: UnsafeUnpin,
impl UnwindSafe for DeclarationLimits
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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