Little doc fixes for RuntimeArgs.
This commit is contained in:
parent
bb53ff866e
commit
5007c9723b
|
@ -2,7 +2,10 @@ use std::any::TypeId;
|
||||||
use value::{RuntimeValue, FromRuntimeValue};
|
use value::{RuntimeValue, FromRuntimeValue};
|
||||||
use {TrapKind, Trap};
|
use {TrapKind, Trap};
|
||||||
|
|
||||||
/// Safe wrapper for list of arguments.
|
/// Wrapper around slice of [`RuntimeValue`] for using it
|
||||||
|
/// as an argument list conveniently.
|
||||||
|
///
|
||||||
|
/// [`RuntimeValue`]: enum.RuntimeValue.html
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct RuntimeArgs<'a>(&'a [RuntimeValue]);
|
pub struct RuntimeArgs<'a>(&'a [RuntimeValue]);
|
||||||
|
|
||||||
|
@ -33,6 +36,8 @@ impl<'a> RuntimeArgs<'a> {
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Returns `Err` if this list has not enough arguments.
|
/// Returns `Err` if this list has not enough arguments.
|
||||||
|
///
|
||||||
|
/// [`RuntimeValue`]: enum.RuntimeValue.html
|
||||||
pub fn nth_value_checked(&self, idx: usize) -> Result<RuntimeValue, Trap> {
|
pub fn nth_value_checked(&self, idx: usize) -> Result<RuntimeValue, Trap> {
|
||||||
if self.0.len() <= idx {
|
if self.0.len() <= idx {
|
||||||
return Err(TrapKind::UnexpectedSignature.into());
|
return Err(TrapKind::UnexpectedSignature.into());
|
||||||
|
|
Loading…
Reference in New Issue