@@ -8,8 +8,8 @@ use ext_php_rs::ffi::{
88 php_module_shutdown, php_module_startup, php_request_shutdown, php_request_startup,
99 sapi_shutdown, sapi_startup, ZEND_RESULT_CODE_SUCCESS ,
1010} ;
11- use ext_php_rs:: prelude:: * ;
1211use ext_php_rs:: zend:: try_catch_first;
12+ use ext_php_rs:: { php_module, prelude:: * } ;
1313use std:: ffi:: c_char;
1414
1515static mut LAST_OUTPUT : String = String :: new ( ) ;
@@ -33,7 +33,7 @@ fn test_sapi() {
3333 builder = builder. ub_write_function ( output_tester) ;
3434
3535 let sapi = builder. build ( ) . unwrap ( ) . into_raw ( ) ;
36- let module = get_module ( ) ;
36+ let module = module :: get_module ( ) ;
3737
3838 unsafe {
3939 ext_php_rs_sapi_startup ( ) ;
@@ -82,17 +82,15 @@ fn test_sapi() {
8282 }
8383}
8484
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-
9585#[ 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+ }
9896}
0 commit comments