Skip to main content

DeclarationLimits

Struct DeclarationLimits 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub const fn memory_bytes(&self) -> NonZeroU64

The memory ceiling, and staging budget, in bytes.

Source

pub const fn instructions(&self) -> NonZeroU64

The instruction ceiling.

Trait Implementations§

Source§

impl Clone for DeclarationLimits

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 Copy for DeclarationLimits

Source§

impl Debug for DeclarationLimits

Source§

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

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

impl Default for DeclarationLimits

Source§

fn default() -> Self

16 MiB, 10 000 000 instructions and 100 000 walk entries.

Source§

impl Eq for DeclarationLimits

Source§

impl PartialEq for DeclarationLimits

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 DeclarationLimits

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.