mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-30 04:39:04 +01:00
Cargo fmt
This commit is contained in:
parent
c87c0dcdb6
commit
891fa4ad3d
@ -9,8 +9,9 @@ use crate::{
|
||||
convert::{FromZendObject, FromZval, FromZvalMut, IntoZval, IntoZvalDyn},
|
||||
error::{Error, Result},
|
||||
ffi::{
|
||||
ext_php_rs_zend_object_release, zend_call_known_function, zend_object, zend_objects_new,
|
||||
HashTable, ZEND_ISEMPTY, ZEND_PROPERTY_EXISTS, ZEND_PROPERTY_ISSET, zend_hash_str_find_ptr_lc, zend_function, object_properties_init,
|
||||
ext_php_rs_zend_object_release, object_properties_init, zend_call_known_function,
|
||||
zend_function, zend_hash_str_find_ptr_lc, zend_object, zend_objects_new, HashTable,
|
||||
ZEND_ISEMPTY, ZEND_PROPERTY_EXISTS, ZEND_PROPERTY_ISSET,
|
||||
},
|
||||
flags::DataType,
|
||||
rc::PhpRc,
|
||||
@ -49,8 +50,8 @@ impl ZendObject {
|
||||
}
|
||||
object_properties_init(ptr, ce as *const _ as *mut _);
|
||||
ptr
|
||||
},
|
||||
Some(v) => v(ce as *const _ as *mut _)
|
||||
}
|
||||
Some(v) => v(ce as *const _ as *mut _),
|
||||
};
|
||||
|
||||
ZBox::from_raw(
|
||||
@ -132,7 +133,6 @@ impl ZendObject {
|
||||
(self.ce as *const ClassEntry).eq(&(T::get_metadata().ce() as *const _))
|
||||
}
|
||||
|
||||
|
||||
#[inline(always)]
|
||||
pub fn try_call_method(&self, name: &str, params: Vec<&dyn IntoZvalDyn>) -> Result<Zval> {
|
||||
let mut retval = Zval::new();
|
||||
@ -147,10 +147,10 @@ impl ZendObject {
|
||||
let res = zend_hash_str_find_ptr_lc(
|
||||
&(*self.ce).function_table,
|
||||
name.as_ptr() as *const i8,
|
||||
name.len()
|
||||
name.len(),
|
||||
) as *mut zend_function;
|
||||
if res.is_null() {
|
||||
return Err(Error::Callable)
|
||||
return Err(Error::Callable);
|
||||
}
|
||||
zend_call_known_function(
|
||||
res,
|
||||
|
@ -208,7 +208,9 @@ impl Zval {
|
||||
|
||||
#[inline(always)]
|
||||
pub fn try_call_method(&self, name: &str, params: Vec<&dyn IntoZvalDyn>) -> Result<Zval> {
|
||||
self.object().ok_or(Error::Object)?.try_call_method(name, params)
|
||||
self.object()
|
||||
.ok_or(Error::Object)?
|
||||
.try_call_method(name, params)
|
||||
}
|
||||
|
||||
/// Returns the value of the zval if it is a reference.
|
||||
|
@ -1,6 +1,12 @@
|
||||
//! Builder and objects for creating classes in the PHP world.
|
||||
|
||||
use crate::{ffi::{zend_class_entry}, flags::ClassFlags, types::{ZendStr, ZendObject}, zend::ExecutorGlobals, boxed::ZBox};
|
||||
use crate::{
|
||||
boxed::ZBox,
|
||||
ffi::zend_class_entry,
|
||||
flags::ClassFlags,
|
||||
types::{ZendObject, ZendStr},
|
||||
zend::ExecutorGlobals,
|
||||
};
|
||||
use std::{convert::TryInto, fmt::Debug, ops::DerefMut};
|
||||
|
||||
/// A PHP class entry.
|
||||
|
@ -1,8 +1,16 @@
|
||||
//! Builder for creating functions and methods in PHP.
|
||||
|
||||
use std::{fmt::Debug, os::raw::c_char, ptr::self};
|
||||
use std::{fmt::Debug, os::raw::c_char, ptr};
|
||||
|
||||
use crate::{ffi::{zend_function_entry, zend_fetch_function_str, zend_function, zend_hash_str_find_ptr_lc, zend_call_known_function}, convert::IntoZvalDyn, types::Zval, error::Result};
|
||||
use crate::{
|
||||
convert::IntoZvalDyn,
|
||||
error::Result,
|
||||
ffi::{
|
||||
zend_call_known_function, zend_fetch_function_str, zend_function, zend_function_entry,
|
||||
zend_hash_str_find_ptr_lc,
|
||||
},
|
||||
types::Zval,
|
||||
};
|
||||
|
||||
use super::ClassEntry;
|
||||
|
||||
@ -58,14 +66,14 @@ impl Function {
|
||||
let res = zend_hash_str_find_ptr_lc(
|
||||
&ce.function_table,
|
||||
name.as_ptr() as *const i8,
|
||||
name.len()
|
||||
name.len(),
|
||||
) as *mut zend_function;
|
||||
if res.is_null() {
|
||||
return None
|
||||
}
|
||||
return Some(*res)
|
||||
}
|
||||
return None;
|
||||
}
|
||||
return Some(*res);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pub fn from_function(name: &str) -> Self {
|
||||
|
@ -4,7 +4,6 @@ use std::ops::{Deref, DerefMut};
|
||||
|
||||
use parking_lot::{const_rwlock, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
|
||||
|
||||
use crate::boxed::ZBox;
|
||||
#[cfg(php82)]
|
||||
use crate::ffi::zend_atomic_bool_store;
|
||||
|
@ -15,8 +15,8 @@ use std::ffi::CString;
|
||||
pub use _type::ZendType;
|
||||
pub use class::ClassEntry;
|
||||
pub use ex::ExecuteData;
|
||||
pub use function::FunctionEntry;
|
||||
pub use function::Function;
|
||||
pub use function::FunctionEntry;
|
||||
pub use globals::ExecutorGlobals;
|
||||
pub use handlers::ZendObjectHandlers;
|
||||
pub use module::ModuleEntry;
|
||||
|
Loading…
Reference in New Issue
Block a user