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

Method new_data

src/objects/capsule.rs:557–562  ·  view source on GitHub ↗

Convenience method to create a capsule for some data The encapsuled data may be an array of functions, but it can't be itself a function directly. May panic when running out of memory.

(py: Python, data: &'static T, name: N)

Source from the content-addressed store, hash-verified

555 /// May panic when running out of memory.
556 ///
557 pub fn new_data<T, N>(py: Python, data: &'static T, name: N) -> Result<Self, NulError>
558 where
559 N: Into<Vec<u8>>,
560 {
561 Self::new(py, data as *const T as *const c_void, name)
562 }
563
564 /// Creates a new capsule from a raw void pointer
565 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected