MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / get_or_init

Method get_or_init

wasm-pdk/src/lib.rs:636–642  ·  view source on GitHub ↗
(&self, init: F)

Source from the content-addressed store, hash-verified

634 /// Unsafe getter; caller must ensure no overlapping &mut borrows across reentrant edge_op calls.
635 #[allow(clippy::mut_from_ref)]
636 pub fn get_or_init<F: FnOnce() -> T>(&self, init: F) -> &mut T {
637 unsafe {
638 let ptr = self.0.get();
639 if (*ptr).is_none() { *ptr = Some(init()); }
640 (*ptr).as_mut().unwrap()
641 }
642 }
643}
644
645impl<T> Default for PluginCell<T> {

Callers

nothing calls this directly

Calls 3

initFunction · 0.85
is_noneMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected