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

Method add_class

src/objects/module.rs:154–159  ·  view source on GitHub ↗

Adds a new extension type to the module. This is a convenience function that initializes the `py_class!()`, sets `new_type.__module__` to this module's name, and adds the type to this module.

(&self, py: Python<'_>)

Source from the content-addressed store, hash-verified

152 /// sets `new_type.__module__` to this module's name,
153 /// and adds the type to this module.
154 pub fn add_class<T>(&self, py: Python<'_>) -> PyResult<()>
155 where
156 T: PythonObjectFromPyClassMacro,
157 {
158 T::add_to_module(py, self)
159 }
160}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected