Skip to main content

FcallObserver

Trait FcallObserver 

Source
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

  1. should_observe is called once per unique function (cached by PHP)
  2. If true, begin is called at function entry
  3. end is called at function exit (even on exceptions)

§Thread Safety

Observer must be Send + Sync. Use thread-safe primitives for mutable state.

Required Methods§

Source

fn should_observe(&self, info: &FcallInfo<'_>) -> bool

Whether to observe a specific function (result is cached by PHP).

Source

fn begin(&self, execute_data: &ExecuteData)

Called when an observed function begins execution.

Source

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".

Implementors§