Skip to main content

Throwable

Trait Throwable 

Source
pub trait Throwable: Error {
    // Required method
    fn get_class(&self) -> &ClassEntry;

    // Provided methods
    fn get_code(&self) -> Option<i64> { ... }
    fn get_message(&self) -> Option<String> { ... }
    fn to_object(&mut self) -> Result<ZObject, Box<dyn Throwable>> { ... }
}
Expand description

PHP Throwable, can cause throwing an exception when setting to crate::values::ZVal.

Required Methods§

Source

fn get_class(&self) -> &ClassEntry

Gets the class reference, implemented PHP Throwable.

Provided Methods§

Source

fn get_code(&self) -> Option<i64>

Gets the exception code.

Source

fn get_message(&self) -> Option<String>

Gets the message.

Source

fn to_object(&mut self) -> Result<ZObject, Box<dyn Throwable>>

Create Exception object.

By default, the Exception is instance of get_class(), the code is get_code and message is get_message;

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Throwable for Infallible

Source§

impl Throwable for dyn Error

Source§

impl<T: Throwable> Throwable for Box<T>

Implementors§