pub trait MemoryWriteHook: Send + Sync {
// Provided method
fn before_write<'life0, 'life1, 'async_trait>(
&'life0 self,
_chunk: &'life1 NewMemoryChunk,
) -> Pin<Box<dyn Future<Output = Result<WriteDecision>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
The hook providers consult before persisting a chunk.
Implementations must be cheap: this fires on every write through the
memory subsystem. The daemon’s matcher-backed hook is O(rules) — that’s
the v1 budget.
Provided Methods§
Sourcefn before_write<'life0, 'life1, 'async_trait>(
&'life0 self,
_chunk: &'life1 NewMemoryChunk,
) -> Pin<Box<dyn Future<Output = Result<WriteDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_write<'life0, 'life1, 'async_trait>(
&'life0 self,
_chunk: &'life1 NewMemoryChunk,
) -> Pin<Box<dyn Future<Output = Result<WriteDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Decide what to do with the chunk. Default impl returns Allow,
which makes wiring a hook optional — most consumers can ignore
this trait entirely.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".