Skip to content

Commit c87dc4b

Browse files
committed
Fmt
1 parent 602a583 commit c87dc4b

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

src/embed/mod.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Provides implementations for running php code from rust.
22
//! It only works on linux for now and you should have `php-embed` installed
33
//!
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
67
78
mod ffi;
89

@@ -43,13 +44,14 @@ static RUN_FN_LOCK: RwLock<()> = const_rwlock(());
4344
impl Embed {
4445
/// Run a php script from a file
4546
///
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
4849
///
4950
/// # Returns
5051
///
5152
/// * `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
5355
///
5456
/// # Example
5557
///
@@ -97,10 +99,10 @@ impl Embed {
9799

98100
/// Start and run embed sapi engine
99101
///
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
104106
///
105107
/// # Returns
106108
///
@@ -127,7 +129,8 @@ impl Embed {
127129
// @TODO handle php thread safe
128130
//
129131
// 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
131134
let _guard = RUN_FN_LOCK.write();
132135

133136
let panic = unsafe {
@@ -155,7 +158,8 @@ impl Embed {
155158

156159
/// Evaluate a php code
157160
///
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
159163
///
160164
/// # Returns
161165
///

src/types/class_object.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use std::{
55
fmt::Debug,
66
mem,
77
ops::{Deref, DerefMut},
8-
ptr::{self, NonNull}, os::raw::c_char,
8+
os::raw::c_char,
9+
ptr::{self, NonNull},
910
};
1011

1112
use crate::{

src/zend/ini_entry_def.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ use crate::{ffi::zend_ini_entry_def, ffi::zend_register_ini_entries, flags::IniE
77

88
/// A Zend ini entry definition.
99
///
10-
/// To register ini definitions for extensions, the IniEntryDef builder should be used. Ini
11-
/// entries should be registered in your module's startup_function via `IniEntryDef::register(Vec<IniEntryDef>)`.
10+
/// To register ini definitions for extensions, the IniEntryDef builder should
11+
/// be used. Ini entries should be registered in your module's startup_function
12+
/// via `IniEntryDef::register(Vec<IniEntryDef>)`.
1213
pub type IniEntryDef = zend_ini_entry_def;
1314

1415
impl IniEntryDef {

src/zend/try_catch.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ pub(crate) unsafe extern "C" fn panic_wrapper<R, F: FnMut() -> R + RefUnwindSafe
1818

1919
/// PHP propose a try catch mechanism in C using setjmp and longjmp (bailout)
2020
/// It store the arg of setjmp into the bailout field of the global executor
21-
/// If a bailout is triggered, the executor will jump to the setjmp and restore the previous setjmp
21+
/// If a bailout is triggered, the executor will jump to the setjmp and restore
22+
/// the previous setjmp
2223
///
2324
/// try_catch allow to use this mechanism
2425
///
@@ -60,10 +61,11 @@ pub fn try_catch<R, F: FnMut() -> R + RefUnwindSafe>(func: F) -> Result<R, Catch
6061
/// # Safety
6162
///
6263
/// This function is unsafe because it can cause memory leaks
63-
/// Since it will jump to the last try catch block, it will not call the destructor of the current scope
64-
///
65-
/// When using this function you should ensure that all the memory allocated in the current scope is released
64+
/// Since it will jump to the last try catch block, it will not call the
65+
/// destructor of the current scope
6666
///
67+
/// When using this function you should ensure that all the memory allocated in
68+
/// the current scope is released
6769
pub unsafe fn bailout() -> ! {
6870
ext_php_rs_zend_bailout();
6971
}

0 commit comments

Comments
 (0)