add doctest for with_stacks

This commit is contained in:
Andrew Dirksen 2018-11-21 09:44:35 -08:00
parent 94a62c2c20
commit 0498125070
1 changed files with 15 additions and 0 deletions

View File

@ -183,6 +183,21 @@ impl Interpreter {
/// Initialize an interpreter that will use `value_stack` and `call_stack`.
///
/// `value_stack` `call_stack` determine the allowed stack size during later executions.
///
/// ```
/// # extern crate wasmi;
/// use wasmi::{Interpreter, StackWithLimit, StackSize};
/// let interpreter = Interpreter::with_stacks(
/// StackWithLimit::with_size(StackSize::from_byte_count(8192)),
/// StackWithLimit::with_size(StackSize::from_element_count(2048)),
/// );
/// # let value_stack_size = StackSize::from_byte_count(8192);
/// # let value_stack = StackWithLimit::with_size(value_stack_size);
/// # let interpreter = Interpreter::with_stacks(
/// # value_stack,
/// # StackWithLimit::with_size(StackSize::from_element_count(2048)),
/// # );
/// ```
pub fn with_stacks(
value_stack: StackWithLimit<RuntimeValueInternal>,
call_stack: StackWithLimit<FunctionContext>,