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
Required Associated Constants§
Required Methods§
Sourcefn set_zval(self, zv: &mut Zval, persistent: bool) -> Result<()>
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:
Error::IntegerOverflow- If the value does not fit in a PHP integer.Error::InvalidCString- If a string in the value contains a NUL byte.
Provided Methods§
Sourcefn into_zval(self, persistent: bool) -> Result<Zval>
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:
Error::IntegerOverflow- If the value does not fit in a PHP integer.Error::InvalidCString- If a string in the value contains a NUL byte.
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<M: SmartStringMode> IntoZval for SmartString<M>
Available on crate feature smartstring only.
impl<M: SmartStringMode> IntoZval for SmartString<M>
Available on crate feature
smartstring only.Source§impl<V, H> IntoZval for IndexSet<V, H>where
V: IntoZval,
H: BuildHasher,
Available on crate feature indexmap only.
impl<V, H> IntoZval for IndexSet<V, H>where
V: IntoZval,
H: BuildHasher,
Available on crate feature
indexmap only.