Struct ext_php_rs::exception::PhpException
source · [−]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
sourceimpl PhpException
impl PhpException
sourcepub fn new(message: String, code: i32, ex: &'static ClassEntry) -> Self
pub fn new(message: String, code: i32, ex: &'static ClassEntry) -> Self
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.
sourcepub fn default(message: String) -> Self
pub fn default(message: String) -> Self
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.
sourcepub fn from_class<T: RegisteredClass>(message: String) -> Self
pub fn from_class<T: RegisteredClass>(message: String) -> Self
Creates an instance of an exception from a PHP class type and a message.
Parameters
message
- Message to contain in the exception.
Trait Implementations
sourceimpl Debug for PhpException
impl Debug for PhpException
Auto Trait Implementations
impl RefUnwindSafe for PhpException
impl !Send for PhpException
impl !Sync for PhpException
impl Unpin for PhpException
impl UnwindSafe for PhpException
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more