Trait FromZendObject

Source
pub trait FromZendObject<'a>: Sized {
    // Required method
    fn from_zend_object(obj: &'a ZendObject) -> Result<Self>;
}
Expand description

FromZendObject is implemented by types which can be extracted from a Zend object.

Normal usage is through the helper method ZendObject::extract:

let obj: ZendObject = ...;
let repr: String = obj.extract();
let props: HashMap = obj.extract();

Should be functionally equivalent to casting an object to another compatible type.

Required Methods§

Source

fn from_zend_object(obj: &'a ZendObject) -> Result<Self>

Extracts Self from the source ZendObject.

§Errors

If the conversion fails, an Error is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromZendObject<'_> for String

Implementors§

Source§

impl<'a> FromZendObject<'a> for &'a Closure

Available on crate feature closure only.
Source§

impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>