Args

Struct Args 

Source
pub struct Args<'d>(pub Vec<Value<'d>>);
Expand description

Provides common utility functions for dealing with function argument lists.

Tuple Fields§

§0: Vec<Value<'d>>

Implementations§

Source§

impl<'d> Args<'d>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn at_least(&self, minimum: usize) -> Result<(), Error>

Ensures that there are at least the requested number of arguments.

Source

pub fn at_most(&self, maximum: usize) -> Result<(), Error>

Ensures that there are no more than the requested number of arguments.

Source

pub fn exactly(&self, expected: usize) -> Result<(), Error>

Ensures that there are exactly the requested number of arguments.

Source

pub fn pop_boolean(&mut self) -> Result<bool, Error>

Removes the last argument and ensures it is a boolean. If the argument is not a boolean, it is converted to one.

Source

pub fn pop_number(&mut self) -> Result<f64, Error>

Removes the last argument and ensures it is a number. If the argument is not a number, it is converted to one.

Source

pub fn pop_string(&mut self) -> Result<String, Error>

Removes the last argument and ensures it is a string. If the argument is not a string, it is converted to one.

Source

pub fn pop_nodeset(&mut self) -> Result<Nodeset<'d>, Error>

Removes the last argument and ensures it is a nodeset. If the argument is not a nodeset, a type mismatch error is returned.

Trait Implementations§

Source§

impl<'d> Index<usize> for Args<'d>

Source§

type Output = Value<'d>

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Value<'d>

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'d> Freeze for Args<'d>

§

impl<'d> !RefUnwindSafe for Args<'d>

§

impl<'d> !Send for Args<'d>

§

impl<'d> !Sync for Args<'d>

§

impl<'d> Unpin for Args<'d>

§

impl<'d> !UnwindSafe for Args<'d>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.