Skip to main content

IntoZval

Trait IntoZval 

Source
pub trait IntoZval: Sized {
    const TYPE: DataType;
    const NULLABLE: bool;

    // 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.

Source

const NULLABLE: bool

Whether converting into a Zval may result in null.

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.
§Errors

Implementations return the error that describes their failure, for example:

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.
§Errors

Implementations return the error that describes their failure, for example:

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IntoZval for &str

Source§

const TYPE: DataType = DataType::String

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for ()

Source§

const TYPE: DataType = DataType::Void

Source§

const NULLABLE: bool = true

Source§

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

Source§

impl IntoZval for String

Source§

const TYPE: DataType = DataType::String

Source§

const NULLABLE: bool = false

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§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for f32

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for f64

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for i8

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for i16

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for i32

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for i64

Source§

const TYPE: DataType = DataType::Long

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for isize

Source§

const TYPE: DataType = DataType::Long

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for u8

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for u16

Source§

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

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for u32

Source§

const TYPE: DataType = DataType::Long

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for u64

Source§

const TYPE: DataType = DataType::Long

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl IntoZval for usize

Source§

const TYPE: DataType = DataType::Long

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<'a, K, V, H> IntoZval for HashMap<K, V, H>
where K: Into<ArrayKey<'a>>, V: IntoZval, H: BuildHasher + Default,

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<'a, K, V, H> IntoZval for IndexMap<K, V, H>
where K: Into<ArrayKey<'a>>, V: IntoZval, H: BuildHasher + Default,

Available on crate feature indexmap only.
Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<'a, K, V> IntoZval for BTreeMap<K, V>
where K: Into<ArrayKey<'a>>, V: IntoZval,

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<'a, K, V> IntoZval for Vec<(K, V)>
where K: Into<ArrayKey<'a>>, V: IntoZval,

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<M: SmartStringMode> IntoZval for SmartString<M>

Available on crate feature smartstring only.
Source§

const TYPE: DataType = DataType::String

Source§

const NULLABLE: bool = false

Source§

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

Source§

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

Source§

const TYPE: DataType = T::TYPE

Source§

const NULLABLE: bool = T::NULLABLE

Source§

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

Source§

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

Source§

const TYPE: DataType = T::TYPE

Source§

const NULLABLE: bool = true

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§

const NULLABLE: bool = false

Source§

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

Source§

impl<V, H> IntoZval for HashSet<V, H>
where V: IntoZval, H: BuildHasher,

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<V, H> IntoZval for IndexSet<V, H>
where V: IntoZval, H: BuildHasher,

Available on crate feature indexmap only.
Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Source§

impl<V> IntoZval for BTreeSet<V>
where V: IntoZval,

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

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

Implementors§

Source§

impl IntoZval for &mut ZendObject

Source§

const TYPE: DataType = DataType::ANY_OBJECT

Source§

const NULLABLE: bool = false

Source§

impl IntoZval for Closure

Available on crate feature closure only.
Source§

impl IntoZval for ZBox<ZendHashTable>

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

impl IntoZval for ZBox<ZendObject>

Source§

const TYPE: DataType = DataType::ANY_OBJECT

Source§

const NULLABLE: bool = false

Source§

impl IntoZval for ZendEmptyArray

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = false

Source§

impl IntoZval for Zval

Source§

const TYPE: DataType = DataType::Mixed

Source§

const NULLABLE: bool = true

Source§

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

Source§

const TYPE: DataType = DataType::String

Source§

const NULLABLE: bool = false

Source§

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

Source§

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

Source§

impl<T> IntoZval for T

Available on crate feature enum only.