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

Method add

src/objects/module.rs:142–147  ·  view source on GitHub ↗

Adds a member to the module. This is a convenience function which can be used from the module's initialization function.

(&self, py: Python, name: &str, value: V)

Source from the content-addressed store, hash-verified

140 ///
141 /// This is a convenience function which can be used from the module's initialization function.
142 pub fn add<V>(&self, py: Python, name: &str, value: V) -> PyResult<()>
143 where
144 V: ToPyObject,
145 {
146 self.as_object().setattr(py, name, value)
147 }
148
149 /// Adds a new extension type to the module.
150 ///

Callers

nothing calls this directly

Calls 2

setattrMethod · 0.80
as_objectMethod · 0.45

Tested by

no test coverage detected