MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_or_init

Method get_or_init

crates/common/src/atomic.rs:90–99  ·  view source on GitHub ↗
(&self, f: F)

Source from the content-addressed store, hash-verified

88 }
89
90 pub fn get_or_init<F>(&self, f: F) -> NonNull<T>
91 where
92 F: FnOnce() -> Box<T>,
93 {
94 enum Void {}
95 match self.get_or_try_init(|| Ok::<_, Void>(f())) {
96 Ok(val) => val,
97 Err(void) => match void {},
98 }
99 }
100
101 pub fn get_or_try_init<F, E>(&self, f: F) -> Result<NonNull<T>, E>
102 where

Callers 15

global_identFunction · 0.45
generate_time_safeFunction · 0.45
wait_callback_registryFunction · 0.45
struct_error_typeFunction · 0.45
newMethod · 0.45
error_encodingMethod · 0.45
error_decodingMethod · 0.45
make_static_typeMethod · 0.45
gc_stateFunction · 0.45
get_or_createMethod · 0.45
exception_groupFunction · 0.45

Calls 2

fFunction · 0.50
get_or_try_initMethod · 0.45

Tested by

no test coverage detected