pub struct FuneraEnv { /* private fields */ }Implementations§
Source§impl FuneraEnv
impl FuneraEnv
pub fn new( llm_client: Client<OpenAIConfig>, model: impl Into<String>, ) -> (Self, FuneraEnvWatcher)
pub fn with_tool_registry(self, tool_registry: ToolRegistry) -> Self
Sourcepub fn effect(&self, body: impl FnOnce() -> Disposer)
pub fn effect(&self, body: impl FnOnce() -> Disposer)
Register a reversible effect.
body runs now (setup) and returns a Disposer that undoes it. The
disposer is pushed onto the env’s accumulator and run in reverse (LIFO)
order by dispose when the env is torn down, so later
registrations — which may depend on earlier ones — are undone first.
ⓘ
env.effect(|| {
let resource = acquire(); // setup: the effect
Box::new(move || release(resource)) // teardown: its inverse
});Sourcepub fn dispose(&self)
pub fn dispose(&self)
Run every registered disposer in reverse (LIFO) order.
This undoes each effect in the reverse of the order it was registered, preventing memory / service leaks from registrations that were never explicitly reverted. Disposal is idempotent (the accumulator is drained) and panic-isolated: a panicking disposer is caught and logged while the remaining disposers still run.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FuneraEnv
impl !UnwindSafe for FuneraEnv
impl Freeze for FuneraEnv
impl Send for FuneraEnv
impl Sync for FuneraEnv
impl Unpin for FuneraEnv
impl UnsafeUnpin for FuneraEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more