pub struct HostLimits {
pub memory_bytes: Option<usize>,
pub stack_bytes: Option<usize>,
pub load_budget: Option<Duration>,
pub call_budget: Option<Duration>,
pub max_nodes: Option<usize>,
}Expand description
The limits an embedding app sets for the apps it embeds (NshLimits
on iOS, NshView.setLimits on Android), and those nsh run --limits
runs an app with as such an app would: each one it leaves out keeps
its default (Limits::default).
Fields§
§memory_bytes: Option<usize>The QuickJS heap, in bytes.
stack_bytes: Option<usize>The interpreter stack, in bytes; at most the default (4 MB), which leaves the engine thread’s stack room for native frames.
load_budget: Option<Duration>Evaluating the bundle.
call_budget: Option<Duration>Any other call into JS.
max_nodes: Option<usize>Nodes the core keeps.
Implementations§
Source§impl HostLimits
impl HostLimits
Sourcepub fn parse(spec: &str) -> Result<HostLimits, String>
pub fn parse(spec: &str) -> Result<HostLimits, String>
Reads limits written as nsh run --limits takes them: key=value
pairs separated by commas, of memory and stack (a size in KB,
MB or GB), load and call (a time in ms or s) and nodes
(a count), say memory=128MB,call=500ms. Each value is above zero;
the empty string sets none.
Trait Implementations§
Source§impl Clone for HostLimits
impl Clone for HostLimits
Source§fn clone(&self) -> HostLimits
fn clone(&self) -> HostLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HostLimits
Source§impl Debug for HostLimits
impl Debug for HostLimits
Source§impl Default for HostLimits
impl Default for HostLimits
Source§fn default() -> HostLimits
fn default() -> HostLimits
Source§impl Display for HostLimits
The limits as HostLimits::parse reads them.
impl Display for HostLimits
The limits as HostLimits::parse reads them.
impl Eq for HostLimits
Source§impl PartialEq for HostLimits
impl PartialEq for HostLimits
impl StructuralPartialEq for HostLimits
Auto Trait Implementations§
impl Freeze for HostLimits
impl RefUnwindSafe for HostLimits
impl Send for HostLimits
impl Sync for HostLimits
impl Unpin for HostLimits
impl UnsafeUnpin for HostLimits
impl UnwindSafe for HostLimits
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.