Trait FromZval

Source
pub trait FromZval<'a>: Sized {
    const TYPE: DataType;

    // Required method
    fn from_zval(zval: &'a Zval) -> Option<Self>;
}
Expand description

Allows zvals to be converted into Rust types in a fallible way. Reciprocal of the IntoZval trait.

Required Associated Constants§

Source

const TYPE: DataType

The corresponding type of the implemented value in PHP.

Required Methods§

Source

fn from_zval(zval: &'a Zval) -> Option<Self>

Attempts to retrieve an instance of Self from a reference to a Zval.

§Parameters
  • zval - Zval to get value from.

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 FromZval<'_> for bool

Source§

const TYPE: DataType = crate::flags::DataType::Bool

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for f32

Source§

const TYPE: DataType = DataType::Double

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for f64

Source§

const TYPE: DataType = crate::flags::DataType::Double

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for i8

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for i16

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for i32

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for i64

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for isize

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for u8

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for u16

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for u32

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for u64

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for usize

Source§

const TYPE: DataType = crate::flags::DataType::Long

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl FromZval<'_> for String

Source§

const TYPE: DataType = crate::flags::DataType::String

Source§

fn from_zval(zval: &Zval) -> Option<Self>

Source§

impl<'a> FromZval<'a> for &'a str

Source§

const TYPE: DataType = DataType::String

Source§

fn from_zval(zval: &'a Zval) -> Option<Self>

Source§

impl<'a, T> FromZval<'a> for Option<T>
where T: FromZval<'a>,

Source§

const TYPE: DataType = T::TYPE

Source§

fn from_zval(zval: &'a Zval) -> Option<Self>

Source§

impl<'a, T> FromZval<'a> for Vec<T>
where T: FromZval<'a>,

Source§

const TYPE: DataType = DataType::Array

Source§

fn from_zval(zval: &'a Zval) -> Option<Self>

Source§

impl<'a, T> FromZval<'a> for HashMap<String, T>
where T: FromZval<'a>,

Source§

const TYPE: DataType = DataType::Array

Source§

fn from_zval(zval: &'a Zval) -> Option<Self>

Implementors§

Source§

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

Available on crate feature closure only.
Source§

impl<'a> FromZval<'a> for &'a ZendHashTable

Source§

const TYPE: DataType = DataType::Array

Source§

impl<'a> FromZval<'a> for &'a ZendObject

Source§

impl<'a> FromZval<'a> for &'a Zval

Source§

const TYPE: DataType = DataType::Mixed

Source§

impl<'a> FromZval<'a> for ArrayKey<'_>

Source§

const TYPE: DataType = DataType::String

Source§

impl<'a> FromZval<'a> for Iterable<'a>

Source§

const TYPE: DataType = DataType::Iterable

Source§

impl<'a> FromZval<'a> for ZendCallable<'a>

Source§

const TYPE: DataType = DataType::Callable

Source§

impl<'a, T> FromZval<'a> for BinarySlice<'a, T>
where T: PackSlice,

Source§

const TYPE: DataType = DataType::String

Source§

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

Source§

impl<T: Pack> FromZval<'_> for Binary<T>

Source§

const TYPE: DataType = DataType::String