MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / import_data

Method import_data

src/objects/capsule.rs:531–533  ·  view source on GitHub ↗

Retrieve the contents of a capsule pointing to some data as a reference. The retrieved data would typically be an array of static data and/or function pointers. This method doesn't work for standalone function pointers. # Safety This method is unsafe, because - nothing guarantees that the `T` type is appropriate for the data referenced by the capsule pointer - the returned lifetime doesn't guara

(py: Python, name: &CStr)

Source from the content-addressed store, hash-verified

529 /// - the returned lifetime doesn't guarantee either to cover the actual lifetime of the data
530 /// (although capsule data is usually static)
531 pub unsafe fn import_data<'a, T>(py: Python, name: &CStr) -> PyResult<&'a T> {
532 Ok(&*(Self::import(py, name)? as *const T))
533 }
534
535 /// Retrieves the contents of a capsule as a void pointer by its name.
536 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected