MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / run

Method run

crates/opencode-tui/src/hooks/use_effect.rs:17–28  ·  view source on GitHub ↗
(&self, effect: F)

Source from the content-addressed store, hash-verified

15 }
16
17 pub fn run<F>(&self, effect: F)
18 where
19 F: FnOnce() -> Option<Box<dyn FnMut()>>,
20 {
21 if let Some(mut cleanup) = self.cleanup.borrow_mut().take() {
22 cleanup();
23 }
24
25 if let Some(new_cleanup) = effect() {
26 *self.cleanup.borrow_mut() = Some(new_cleanup);
27 }
28 }
29}
30
31impl Default for UseEffect {

Callers

nothing calls this directly

Calls 1

cleanupFunction · 0.85

Tested by

no test coverage detected