1
1
//! Provides implementations for running php code from rust.
2
2
//! It only works on linux for now and you should have `php-embed` installed
3
3
//!
4
- //! This crate was only test with PHP 8.2 please report any issue with other version
5
- //! You should only use this crate for test purpose, it's not production ready
4
+ //! This crate was only test with PHP 8.2 please report any issue with other
5
+ //! version You should only use this crate for test purpose, it's not production
6
+ //! ready
6
7
7
8
mod ffi;
8
9
@@ -43,13 +44,14 @@ static RUN_FN_LOCK: RwLock<()> = const_rwlock(());
43
44
impl Embed {
44
45
/// Run a php script from a file
45
46
///
46
- /// This function will only work correctly when used inside the `Embed::run` function
47
- /// otherwise behavior is unexpected
47
+ /// This function will only work correctly when used inside the `Embed::run`
48
+ /// function otherwise behavior is unexpected
48
49
///
49
50
/// # Returns
50
51
///
51
52
/// * `Ok(())` - The script was executed successfully
52
- /// * `Err(EmbedError)` - An error occured during the execution of the script
53
+ /// * `Err(EmbedError)` - An error occured during the execution of the
54
+ /// script
53
55
///
54
56
/// # Example
55
57
///
@@ -97,10 +99,10 @@ impl Embed {
97
99
98
100
/// Start and run embed sapi engine
99
101
///
100
- /// This function will allow to run php code from rust, the same PHP context is keep between calls
101
- /// inside the function passed to this method.
102
- /// Which means subsequent calls to `Embed::eval` or `Embed::run_script` will be able to access
103
- /// variables defined in previous calls
102
+ /// This function will allow to run php code from rust, the same PHP context
103
+ /// is keep between calls inside the function passed to this method.
104
+ /// Which means subsequent calls to `Embed::eval` or `Embed::run_script`
105
+ /// will be able to access variables defined in previous calls
104
106
///
105
107
/// # Returns
106
108
///
@@ -127,7 +129,8 @@ impl Embed {
127
129
// @TODO handle php thread safe
128
130
//
129
131
// This is to prevent multiple threads from running php at the same time
130
- // At some point we should detect if php is compiled with thread safety and avoid doing that in this case
132
+ // At some point we should detect if php is compiled with thread safety and
133
+ // avoid doing that in this case
131
134
let _guard = RUN_FN_LOCK . write ( ) ;
132
135
133
136
let panic = unsafe {
@@ -155,7 +158,8 @@ impl Embed {
155
158
156
159
/// Evaluate a php code
157
160
///
158
- /// This function will only work correctly when used inside the `Embed::run` function
161
+ /// This function will only work correctly when used inside the `Embed::run`
162
+ /// function
159
163
///
160
164
/// # Returns
161
165
///
0 commit comments