Struct ext_php_rs::boxed::ZBox

source ·
pub struct ZBox<T: ZBoxable>(/* private fields */);
Expand description

A pointer type for heap allocation using the Zend memory manager.

See the module level documentation for more.

Implementations§

source§

impl<T: ZBoxable> ZBox<T>

source

pub unsafe fn from_raw(ptr: *mut T) -> Self

Creates a new box from a given pointer.

§Parameters
  • ptr - A non-null, well-aligned pointer to a T.
§Safety

Caller must ensure that ptr is non-null, well-aligned and pointing to a T.

source

pub fn into_raw(self) -> &'static mut T

Returns the pointer contained by the box, dropping the box in the process. The data pointed to by the returned pointer is not released.

§Safety

The caller is responsible for managing the memory pointed to by the returned pointer, including freeing the memory.

Trait Implementations§

source§

impl<T: ZBoxable> AsRef<T> for ZBox<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: ZBoxable> Borrow<T> for ZBox<T>

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T: RegisteredClass + Clone> Clone for ZBox<ZendClassObject<T>>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Clone for ZBox<ZendHashTable>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ZBoxable + Debug> Debug for ZBox<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: RegisteredClass + Default> Default for ZBox<ZendClassObject<T>>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Default for ZBox<ZendHashTable>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: ZBoxable> Deref for ZBox<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ZBoxable> DerefMut for ZBox<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: ZBoxable> Drop for ZBox<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<&CStr> for ZBox<ZendStr>

source§

fn from(value: &CStr) -> Self

Converts to this type from the input type.
source§

impl From<&str> for ZBox<ZendStr>

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<CString> for ZBox<ZendStr>

source§

fn from(value: CString) -> Self

Converts to this type from the input type.
source§

impl From<Cow<'_, _zend_string>> for ZBox<ZendStr>

source§

fn from(value: Cow<'_, ZendStr>) -> Self

Converts to this type from the input type.
source§

impl From<String> for ZBox<ZendStr>

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl<T: RegisteredClass> From<ZBox<ZendClassObject<T>>> for ZBox<ZendObject>

source§

fn from(obj: ZBox<ZendClassObject<T>>) -> Self

Converts to this type from the input type.
source§

impl From<ZBox<_zend_string>> for Cow<'_, ZendStr>

source§

fn from(value: ZBox<ZendStr>) -> Self

Converts to this type from the input type.
source§

impl<'a> FromIterator<(&'a str, _zval_struct)> for ZBox<ZendHashTable>

source§

fn from_iter<T: IntoIterator<Item = (&'a str, Zval)>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<(u64, _zval_struct)> for ZBox<ZendHashTable>

source§

fn from_iter<T: IntoIterator<Item = (u64, Zval)>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<_zval_struct> for ZBox<ZendHashTable>

source§

fn from_iter<T: IntoIterator<Item = Zval>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

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

source§

const TYPE: DataType = _

The corresponding type of the implemented value in PHP.
source§

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

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more
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. Read more
source§

impl IntoZval for ZBox<ZendHashTable>

source§

const TYPE: DataType = DataType::Array

The corresponding type of the implemented value in PHP.
source§

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

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more
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. Read more
source§

impl IntoZval for ZBox<ZendObject>

source§

const TYPE: DataType = _

The corresponding type of the implemented value in PHP.
source§

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

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more
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. Read more
source§

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

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: HashMap<K, V>) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Vec<T>> for ZBox<ZendHashTable>
where T: IntoZval,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Vec<T>) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for ZBox<T>
where T: RefUnwindSafe,

§

impl<T> !Send for ZBox<T>

§

impl<T> !Sync for ZBox<T>

§

impl<T> Unpin for ZBox<T>

§

impl<T> UnwindSafe for ZBox<T>
where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoZvalDyn for T
where T: IntoZval + Clone,

source§

fn as_zval(&self, persistent: bool) -> Result<_zval_struct, Error>

Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful. self is cloned before being converted into a zval. Read more
source§

fn get_type(&self) -> DataType

Returns the PHP type of the type.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.