MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / get_or_insert_shared

Function get_or_insert_shared

src/borrow/shared.rs:108–114  ·  view source on GitHub ↗
(py: Python<'py>)

Source from the content-addressed store, hash-verified

106static SHARED: SharedPtr = SharedPtr(PyOnceLock::new());
107
108fn get_or_insert_shared<'py>(py: Python<'py>) -> PyResult<&'py Shared> {
109 let shared = SHARED.0.get_or_try_init(py, || insert_shared(py))?;
110
111 // SAFETY: We inserted the capsule if it was missing
112 // and verified that it contains a compatible version.
113 Ok(unsafe { shared.as_ref() })
114}
115
116// This function will publish this extension's version of the shared borrow checking API
117// as a capsule placed at `numpy.core.multiarray._RUST_NUMPY_BORROW_CHECKING_API` and

Callers 5

acquireFunction · 0.85
acquire_mutFunction · 0.85
releaseFunction · 0.85
release_mutFunction · 0.85
get_borrow_flags_stateFunction · 0.85

Calls 1

insert_sharedFunction · 0.85

Tested by

no test coverage detected