pub struct DcWasmResourceLimits {
pub accounting_version: u32,
pub max_instructions_per_step: u64,
pub max_memory_pages: usize,
pub physical_max_memory_pages: usize,
pub max_table_elements: usize,
pub physical_max_table_elements: usize,
pub max_step_output_bytes: usize,
pub max_session_output_bytes: usize,
pub max_capability_payload_bytes: usize,
pub max_trace_bytes: usize,
}Expand description
Resource budgets enforced on a DcWasmSession for portable compute quota,
linear memory growth, table element capacity, single-step output slice length,
cumulative session output bytes, capability request/response payloads, and trace retention.
Fields§
§accounting_version: u32Deterministic resource-accounting rule version (WASM_RESOURCE_ACCOUNTING_VERSION).
max_instructions_per_step: u64Maximum portable WASM compute quota units allowed before raising WasmResourceInterruption::ComputeQuotaExhausted.
max_memory_pages: usizeLogical maximum number of 64 KiB linear memory pages allowed across the session store.
physical_max_memory_pages: usizePhysical host allocation limit for 64 KiB linear memory pages (usize::MAX unless constrained).
max_table_elements: usizeLogical maximum number of table elements allowed across the session store.
physical_max_table_elements: usizePhysical host allocation limit for table elements (usize::MAX unless constrained).
max_step_output_bytes: usizeMaximum byte length allowed for a single step’s output slice (out_len in the mailbox).
max_session_output_bytes: usizeMaximum cumulative output bytes allowed across all steps in a session.
max_capability_payload_bytes: usizeMaximum byte length allowed for a single capability request or response payload
(separate from max_session_output_bytes).
max_trace_bytes: usizeMaximum cumulative byte length allowed for a retained execution trace buffer
(separate from max_session_output_bytes).
Implementations§
Source§impl DcWasmResourceLimits
impl DcWasmResourceLimits
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Returns the default resource budgets for a DcWasmSession.
Sourcepub const fn with_accounting_version(self, accounting_version: u32) -> Self
pub const fn with_accounting_version(self, accounting_version: u32) -> Self
Returns a copy with accounting_version set to the given accounting version.
Sourcepub const fn with_max_instructions_per_step(
self,
max_instructions_per_step: u64,
) -> Self
pub const fn with_max_instructions_per_step( self, max_instructions_per_step: u64, ) -> Self
Returns a copy with max_instructions_per_step set to the given compute quota allowance.
Sourcepub const fn with_max_memory_pages(self, max_memory_pages: usize) -> Self
pub const fn with_max_memory_pages(self, max_memory_pages: usize) -> Self
Returns a copy with max_memory_pages set to the given logical 64 KiB page cap.
Sourcepub const fn with_physical_max_memory_pages(
self,
physical_max_memory_pages: usize,
) -> Self
pub const fn with_physical_max_memory_pages( self, physical_max_memory_pages: usize, ) -> Self
Returns a copy with physical_max_memory_pages set to the given physical 64 KiB page cap.
Sourcepub const fn with_max_table_elements(self, max_table_elements: usize) -> Self
pub const fn with_max_table_elements(self, max_table_elements: usize) -> Self
Returns a copy with max_table_elements set to the given logical table element cap.
Sourcepub const fn with_physical_max_table_elements(
self,
physical_max_table_elements: usize,
) -> Self
pub const fn with_physical_max_table_elements( self, physical_max_table_elements: usize, ) -> Self
Returns a copy with physical_max_table_elements set to the given physical table element cap.
Sourcepub const fn with_max_step_output_bytes(
self,
max_step_output_bytes: usize,
) -> Self
pub const fn with_max_step_output_bytes( self, max_step_output_bytes: usize, ) -> Self
Returns a copy with max_step_output_bytes set to the given single-step output cap.
Sourcepub const fn with_max_session_output_bytes(
self,
max_session_output_bytes: usize,
) -> Self
pub const fn with_max_session_output_bytes( self, max_session_output_bytes: usize, ) -> Self
Returns a copy with max_session_output_bytes set to the given cumulative session output cap.
Sourcepub const fn with_max_capability_payload_bytes(
self,
max_capability_payload_bytes: usize,
) -> Self
pub const fn with_max_capability_payload_bytes( self, max_capability_payload_bytes: usize, ) -> Self
Returns a copy with max_capability_payload_bytes set to the given capability payload cap.
Sourcepub const fn with_max_trace_bytes(self, max_trace_bytes: usize) -> Self
pub const fn with_max_trace_bytes(self, max_trace_bytes: usize) -> Self
Returns a copy with max_trace_bytes set to the given retained trace buffer cap.
Sourcepub const fn apply_watchdog_bounds(self, watchdog: DcWasmWatchdogLimits) -> Self
pub const fn apply_watchdog_bounds(self, watchdog: DcWasmWatchdogLimits) -> Self
Applies emergency host DcWasmWatchdogLimits on top of this logical supervisor policy.
Physical memory and table ceilings are clamped to the watchdog’s physical bounds
(while preserving max_memory_pages and max_table_elements so physical exhaustion
below logical quota interrupts externally rather than returning a normal -1).
Sourcepub fn encode_canonical_config_bytes(&self) -> Vec<u8> ⓘ
pub fn encode_canonical_config_bytes(&self) -> Vec<u8> ⓘ
Serializes these compiled resource limits into a canonical 76-byte little-endian configuration snapshot for deterministic execution trace recording and replay.
Sourcepub fn decode_canonical_config_bytes(bytes: &[u8]) -> Result<Self>
pub fn decode_canonical_config_bytes(bytes: &[u8]) -> Result<Self>
Decodes a canonical 76-byte configuration snapshot produced by
Self::encode_canonical_config_bytes.
§Errors
Returns an error if bytes.len() != 76 or if accounting_version is unsupported.
Trait Implementations§
Source§impl Clone for DcWasmResourceLimits
impl Clone for DcWasmResourceLimits
Source§fn clone(&self) -> DcWasmResourceLimits
fn clone(&self) -> DcWasmResourceLimits
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DcWasmResourceLimits
impl Debug for DcWasmResourceLimits
Source§impl Default for DcWasmResourceLimits
impl Default for DcWasmResourceLimits
Source§impl PartialEq for DcWasmResourceLimits
impl PartialEq for DcWasmResourceLimits
impl Copy for DcWasmResourceLimits
impl Eq for DcWasmResourceLimits
impl StructuralPartialEq for DcWasmResourceLimits
Auto Trait Implementations§
impl Freeze for DcWasmResourceLimits
impl RefUnwindSafe for DcWasmResourceLimits
impl Send for DcWasmResourceLimits
impl Sync for DcWasmResourceLimits
impl Unpin for DcWasmResourceLimits
impl UnwindSafe for DcWasmResourceLimits
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
fn exact_into(self) -> U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);