pub trait FcallObserver: 'static {
// Required methods
fn should_observe(&self, info: &FcallInfo<'_>) -> bool;
fn begin(&self, execute_data: &ExecuteData);
fn end(&self, execute_data: &ExecuteData, retval: Option<&Zval>);
}Available on crate feature
observer only.Expand description
Trait for observing PHP function calls.
§Lifecycle
should_observeis called once per unique function (cached by PHP)- If
true,beginis called at function entry endis called at function exit (even on exceptions)
§Thread Safety
Observer must be Send + Sync. Use thread-safe primitives for mutable state.
Required Methods§
Sourcefn should_observe(&self, info: &FcallInfo<'_>) -> bool
fn should_observe(&self, info: &FcallInfo<'_>) -> bool
Whether to observe a specific function (result is cached by PHP).
Sourcefn begin(&self, execute_data: &ExecuteData)
fn begin(&self, execute_data: &ExecuteData)
Called when an observed function begins execution.
Sourcefn end(&self, execute_data: &ExecuteData, retval: Option<&Zval>)
fn end(&self, execute_data: &ExecuteData, retval: Option<&Zval>)
Called when an observed function ends execution (even on exceptions).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".