Struct ext_php_rs::args::Arg[][src]

pub struct Arg<'a> { /* fields omitted */ }
Expand description

Represents an argument to a function.

Implementations

Creates a new argument.

Parameters
  • name - The name of the parameter.
  • _type - The type of the parameter.

Sets the argument as a reference.

Sets the argument as variadic.

Sets the argument as nullable.

Sets the default value for the argument.

Attempts to consume the argument, converting the inner type into T. Upon success, the result is returned in a Result.

If the conversion fails (or the argument contains no value), the argument is returned in an Err variant.

As this function consumes, it cannot return a reference to the underlying zval.

Attempts to retrieve the value of the argument. This will be None until the ArgParser is used to parse the arguments.

Attempts to return a reference to the arguments internal Zval.

Returns
  • Some(&Zval) - The internal zval.
  • None - The argument was empty.

Attempts to call the argument as a callable with a list of arguments to pass to the function. Note that a thrown exception inside the callable is not detectable, therefore you should check if the return value is valid rather than unwrapping. Returns a result containing the return value of the function, or an error.

You should not call this function directly, rather through the call_user_func macro.

Parameters
  • params - A list of parameters to call the function with.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.