@@ -8,8 +8,8 @@ use ext_php_rs::ffi::{
8
8
php_module_shutdown, php_module_startup, php_request_shutdown, php_request_startup,
9
9
sapi_shutdown, sapi_startup, ZEND_RESULT_CODE_SUCCESS ,
10
10
} ;
11
- use ext_php_rs:: prelude:: * ;
12
11
use ext_php_rs:: zend:: try_catch_first;
12
+ use ext_php_rs:: { php_module, prelude:: * } ;
13
13
use std:: ffi:: c_char;
14
14
15
15
static mut LAST_OUTPUT : String = String :: new ( ) ;
@@ -33,7 +33,7 @@ fn test_sapi() {
33
33
builder = builder. ub_write_function ( output_tester) ;
34
34
35
35
let sapi = builder. build ( ) . unwrap ( ) . into_raw ( ) ;
36
- let module = get_module ( ) ;
36
+ let module = module :: get_module ( ) ;
37
37
38
38
unsafe {
39
39
ext_php_rs_sapi_startup ( ) ;
@@ -82,17 +82,15 @@ fn test_sapi() {
82
82
}
83
83
}
84
84
85
- /// Gives you a nice greeting!
86
- ///
87
- /// @param string $name Your name.
88
- ///
89
- /// @return string Nice greeting!
90
- #[ php_function]
91
- pub fn hello_world ( name : String ) -> String {
92
- format ! ( "Hello, {}!" , name)
93
- }
94
-
95
85
#[ php_module]
96
- pub fn module ( module : ModuleBuilder ) -> ModuleBuilder {
97
- module
86
+ mod module {
87
+ /// Gives you a nice greeting!
88
+ ///
89
+ /// @param string $name Your name.
90
+ ///
91
+ /// @return string Nice greeting!
92
+ #[ php_function]
93
+ pub fn hello_world ( name : String ) -> String {
94
+ format ! ( "Hello, {}!" , name)
95
+ }
98
96
}
0 commit comments