fix doctest

This commit is contained in:
Andrew Dirksen 2018-11-21 18:24:01 -08:00
parent fc677010d1
commit 7819950790
1 changed files with 3 additions and 3 deletions

View File

@ -130,10 +130,10 @@ impl<T> StackWithLimit<T> {
/// ```
/// # extern crate wasmi;
/// # use wasmi::{StackWithLimit, StackSize};
/// let bstack = StackWithLimit::<i32>::with_size(StackSize::from_element_count(2));
/// let mut bstack = StackWithLimit::<i32>::with_size(StackSize::from_element_count(2));
/// bstack.push(4);
/// assert_eq!(bstack.nth_from_top(0, Some(&4));
/// assert_eq!(bstack.nth_from_top(1, None);
/// assert_eq!(bstack.nth_from_top(0), Some(&4));
/// assert_eq!(bstack.nth_from_top(1), None);
/// ```
pub fn nth_from_top(&self, depth: usize) -> Option<&T> {
// Be cognizant of integer underflow and overflow here. Both are possible in this situation.