Struct ext_php_rs::php::types::callable::Callable[][src]

pub struct Callable<'a>(_);
Expand description

Acts as a wrapper around a callable Zval. Allows the owner to call the Zval as if it was a PHP function through the try_call method.

Implementations

Attempts to create a new Callable from a zval.

Parameters

  • callable - The underlying Zval that is callable.

Errors

Returns an error if the Zval was not callable.

Attempts to create a new Callable by taking ownership of a Zval. Returns a result containing the callable if the zval was callable.

Parameters

  • callable - TThe underlying Zval that is callable.

Attempts to create a new Callable from a function name. Returns a result containing the callable if the function existed and was callable.

Parameters

  • name - Name of the callable function.

Attempts to call the 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

The corresponding type of the implemented value in PHP.

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.

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.