@@ -60,8 +60,7 @@ impl<T: Default + Send + 'static> DynamicClass<T> {
6060
6161impl < T : Send + ' static > DynamicClass < T > {
6262 pub fn new_with_constructor (
63- class_name : impl ToString ,
64- state_constructor : impl Fn ( ) -> T + Send + Sync + ' static ,
63+ class_name : impl ToString , state_constructor : impl Fn ( ) -> T + Send + Sync + ' static ,
6564 ) -> Self {
6665 Self {
6766 class_name : class_name. to_string ( ) ,
@@ -72,15 +71,12 @@ impl<T: Send + 'static> DynamicClass<T> {
7271 _p : Default :: default ( ) ,
7372 }
7473 // let ptr = &dyn_class.data_constructor as *const _ as usize;
75- // dyn_class.add_property(DATA_CONSTRUCTOR_PROPERTY_NAME, ptr.to_string());
74+ // dyn_class.add_property(DATA_CONSTRUCTOR_PROPERTY_NAME,
75+ // ptr.to_string());
7676 }
7777
7878 pub fn add_method < F , R > (
79- & mut self ,
80- name : impl ToString ,
81- vis : Visibility ,
82- handler : F ,
83- arguments : Vec < Argument > ,
79+ & mut self , name : impl ToString , vis : Visibility , handler : F , arguments : Vec < Argument > ,
8480 ) where
8581 F : Fn ( & mut Object < T > , & mut [ Val ] ) -> R + Send + Sync + ' static ,
8682 R : SetVal + ' static ,
@@ -95,11 +91,7 @@ impl<T: Send + 'static> DynamicClass<T> {
9591 }
9692
9793 pub fn add_static_method < F , R > (
98- & mut self ,
99- name : impl ToString ,
100- vis : Visibility ,
101- handler : F ,
102- arguments : Vec < Argument > ,
94+ & mut self , name : impl ToString , vis : Visibility , handler : F , arguments : Vec < Argument > ,
10395 ) where
10496 F : Fn ( & mut [ Val ] ) -> R + Send + Sync + ' static ,
10597 R : SetVal + ' static ,
@@ -115,13 +107,11 @@ impl<T: Send + 'static> DynamicClass<T> {
115107
116108 /// Declare property.
117109 ///
118- /// The argument `value` should be `Copy` because 'zend_declare_property' receive only scalar
119- /// zval , otherwise will report fatal error: "Internal zvals cannot be refcounted".
110+ /// The argument `value` should be `Copy` because 'zend_declare_property'
111+ /// receive only scalar zval , otherwise will report fatal error:
112+ /// "Internal zvals cannot be refcounted".
120113 pub fn add_property (
121- & mut self ,
122- name : impl ToString ,
123- visibility : Visibility ,
124- value : impl Into < Scalar > ,
114+ & mut self , name : impl ToString , visibility : Visibility , value : impl Into < Scalar > ,
125115 ) {
126116 self . property_entities
127117 . push ( PropertyEntity :: new ( name, visibility, value) ) ;
@@ -168,11 +158,13 @@ pub type StatelessClassEntry = ClassEntry<()>;
168158///
169159/// # Generic
170160///
171- /// 1. Any `zend_class_entry` can be make into `ClassEntry<()>`, alias as [StatelessClassEntry].
161+ /// 1. Any `zend_class_entry` can be make into `ClassEntry<()>`, alias as
162+ /// [StatelessClassEntry].
172163///
173- /// 2. Only the `zend_class_entry` created by [crate::modules::Module::add_class] can be make into
174- /// `ClassEntry<T>`, where `T` is the type defined by [Classifiable::state_type_id], as the inner
175- /// state of `ClassEntry<T>` and `Object<T>`.
164+ /// 2. Only the `zend_class_entry` created by
165+ /// [crate::modules::Module::add_class] can be make into `ClassEntry<T>`, where
166+ /// `T` is the type defined by [Classifiable::state_type_id], as the inner state
167+ /// of `ClassEntry<T>` and `Object<T>`.
176168#[ repr( transparent) ]
177169pub struct ClassEntry < T : ' static > {
178170 inner : zend_class_entry ,
@@ -226,8 +218,8 @@ impl<T: 'static> ClassEntry<T> {
226218 Ok ( object)
227219 }
228220
229- /// Create the object from class, without calling `__construct`, be careful when `__construct`
230- /// is necessary.
221+ /// Create the object from class, without calling `__construct`, be careful
222+ /// when `__construct` is necessary.
231223 pub fn init_object ( & self ) -> crate :: Result < EBox < Object < T > > > {
232224 unsafe {
233225 let ptr = self . as_ptr ( ) as * mut _ ;
0 commit comments