pub trait IntoZval: Sized {
    const TYPE: DataType;

    // Required method
    fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>;

    // Provided method
    fn into_zval(self, persistent: bool) -> Result<Zval> { ... }
}
Expand description

Provides implementations for converting Rust primitive types into PHP zvals. Alternative to the built-in Rust From and TryFrom implementations, allowing the caller to specify whether the Zval contents will persist between requests.

Required Associated Constants§

source

const TYPE: DataType

The corresponding type of the implemented value in PHP.

Required Methods§

source

fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful.

§Parameters
  • zv - The Zval to set the content of.
  • persistent - Whether the contents of the Zval will persist between requests.

Provided Methods§

source

fn into_zval(self, persistent: bool) -> Result<Zval>

Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful.

§Parameters
  • persistent - Whether the contents of the Zval will persist between requests.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl IntoZval for &str

source§

const TYPE: DataType = DataType::String

source§

fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>

source§

impl IntoZval for bool

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for f32

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for f64

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for i8

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for i16

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for i32

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for i64

source§

const TYPE: DataType = DataType::Long

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for isize

source§

const TYPE: DataType = DataType::Long

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for u8

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for u16

source§

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

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for u32

source§

const TYPE: DataType = DataType::Long

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for u64

source§

const TYPE: DataType = DataType::Long

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for ()

source§

const TYPE: DataType = DataType::Void

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for usize

source§

const TYPE: DataType = DataType::Long

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl IntoZval for String

source§

const TYPE: DataType = DataType::String

source§

fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>

source§

impl<K, V> IntoZval for HashMap<K, V>
where K: AsRef<str>, V: IntoZval,

source§

const TYPE: DataType = DataType::Array

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl<T> IntoZval for Option<T>
where T: IntoZval,

source§

const TYPE: DataType = T::TYPE

source§

fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>

source§

impl<T> IntoZval for Vec<T>
where T: IntoZval,

source§

const TYPE: DataType = DataType::Array

source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

source§

impl<T, E> IntoZval for Result<T, E>
where T: IntoZval, E: Into<PhpException>,

source§

const TYPE: DataType = T::TYPE

source§

fn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>

Implementors§

source§

impl IntoZval for ZBox<ZendHashTable>

source§

const TYPE: DataType = DataType::Array

source§

impl IntoZval for ZBox<ZendObject>

source§

impl IntoZval for Closure

Available on crate feature closure only.
source§

impl IntoZval for Zval

source§

const TYPE: DataType = DataType::Mixed

source§

impl<'a> IntoZval for &'a mut ZendObject

source§

impl<T: Pack> IntoZval for Binary<T>

source§

const TYPE: DataType = DataType::String

source§

impl<T: RegisteredClass> IntoZval for &mut ZendClassObject<T>

source§

impl<T: RegisteredClass> IntoZval for ZBox<ZendClassObject<T>>