pub struct ZendClassObject<T> {
pub std: ZendObject,
/* private fields */
}Expand description
Representation of a Zend class object in memory.
Fields§
§std: ZendObjectThe standard zend object.
Implementations§
Source§impl<T: RegisteredClass> ZendClassObject<T>
impl<T: RegisteredClass> ZendClassObject<T>
Sourcepub fn new(val: T) -> ZBox<Self>
pub fn new(val: T) -> ZBox<Self>
Creates a new ZendClassObject of type T, where T is a
RegisteredClass in PHP, storing the given value val inside the
object.
§Parameters
val- The value to store inside the object.
§Panics
Panics if memory was unable to be allocated for the new object.
Sourcepub fn new_uninit(ce: Option<&'static ClassEntry>) -> ZBox<Self>
pub fn new_uninit(ce: Option<&'static ClassEntry>) -> ZBox<Self>
Creates a new ZendClassObject of type T, with an uninitialized
internal object.
Until initialize is called, try_borrow and try_borrow_mut
return BorrowError::Uninitialized and the Clone
implementation panics.
§Panics
Panics if memory was unable to be allocated for the new object.
Sourcepub fn initialize(&self, val: T) -> Result<Option<T>, BorrowError>
pub fn initialize(&self, val: T) -> Result<Option<T>, BorrowError>
Sourcepub fn try_borrow(&self) -> Result<ClassRef<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<ClassRef<'_, T>, BorrowError>
Borrows the Rust value of the object.
§Errors
BorrowError::MutablyBorrowed- The value is borrowed mutably.BorrowError::Uninitialized- The object has no Rust value.
Sourcepub fn try_borrow_mut(&self) -> Result<ClassRefMut<'_, T>, BorrowError>
pub fn try_borrow_mut(&self) -> Result<ClassRefMut<'_, T>, BorrowError>
Borrows the Rust value of the object mutably.
§Errors
BorrowError::Borrowed- The value is borrowed.BorrowError::Uninitialized- The object has no Rust value.
Sourcepub fn from_zend_obj(std: &zend_object) -> Option<&Self>
pub fn from_zend_obj(std: &zend_object) -> Option<&Self>
Returns a reference to the ZendClassObject of a given zend
object obj. Returns None if the given object is not of the
type T.
§Parameters
obj- The zend object to get theZendClassObjectfor.
§Panics
- If the std offset over/underflows
isize.
Sourcepub fn get_mut_zend_obj(&mut self) -> &mut zend_object
pub fn get_mut_zend_obj(&mut self) -> &mut zend_object
Returns a mutable reference to the underlying Zend object.
Trait Implementations§
Source§impl<T: Debug> Debug for ZendClassObject<T>
impl<T: Debug> Debug for ZendClassObject<T>
Source§impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>
impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>
Source§fn from_zend_object(obj: &'a ZendObject) -> Result<Self>
fn from_zend_object(obj: &'a ZendObject) -> Result<Self>
Source§impl<'a, T: RegisteredClass> FromZval<'a> for &'a ZendClassObject<T>
impl<'a, T: RegisteredClass> FromZval<'a> for &'a ZendClassObject<T>
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
null and may be omitted. Read moreSource§fn from_missing() -> Option<Self>
fn from_missing() -> Option<Self>
None means the argument is required. Read more