pub struct PhpException { /* private fields */ }
Expand description

Represents a PHP exception which can be thrown using the throw() function. Primarily used to return from a Result<T, PhpException> which can immediately be thrown by the ext-php-rs macro API.

There are default From implementations for any type that implements ToString, so these can also be returned from these functions. You can also implement From<T> for your custom error type.

Implementations§

Creates a new exception instance.

Parameters
  • message - Message to contain in the exception.
  • code - Integer code to go inside the exception.
  • ex - Exception type to throw.

Creates a new default exception instance, using the default PHP Exception type as the exception type, with an integer code of zero.

Parameters
  • message - Message to contain in the exception.

Creates an instance of an exception from a PHP class type and a message.

Parameters
  • message - Message to contain in the exception.

Throws the exception, returning nothing inside a result if successful and an error otherwise.

Trait Implementations§

Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

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

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.