Struct ext_php_rs::args::ArgParser

source ·
pub struct ArgParser<'a, 'b> { /* private fields */ }
Expand description

Parses the arguments of a function.

Implementations§

source§

impl<'a, 'b> ArgParser<'a, 'b>

source

pub fn new(arg_zvals: Vec<Option<&'a mut Zval>>) -> Self

Builds a new function argument parser.

source

pub fn arg(self, arg: &'b mut Arg<'a>) -> Self

Adds a new argument to the parser.

§Parameters
  • arg - The argument to add to the parser.
source

pub fn not_required(self) -> Self

Sets the next arguments to be added as not required.

source

pub fn parse(self) -> Result<()>

Uses the argument parser to parse the arguments contained in the given ExecuteData object. Returns successfully if the arguments were parsed.

This function can only be safely called from within an exported PHP function.

§Parameters
  • execute_data - The execution data from the function.
§Errors

Returns an Error type if there were too many or too little arguments passed to the function. The user has already been notified so you should break execution after seeing an error type.

Auto Trait Implementations§

§

impl<'a, 'b> RefUnwindSafe for ArgParser<'a, 'b>

§

impl<'a, 'b> !Send for ArgParser<'a, 'b>

§

impl<'a, 'b> !Sync for ArgParser<'a, 'b>

§

impl<'a, 'b> Unpin for ArgParser<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for ArgParser<'a, 'b>

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>,

§

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>,

§

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.