MCPcopy Index your code
hub / github.com/RustPython/RustPython / new_method

Method new_method

crates/vm/src/vm/vm_new.rs:89–102  ·  view source on GitHub ↗
(
        &self,
        name: &'static str,
        class: &'static Py<PyType>,
        f: F,
    )

Source from the content-addressed store, hash-verified

87 }
88
89 pub fn new_method<F, FKind>(
90 &self,
91 name: &'static str,
92 class: &'static Py<PyType>,
93 f: F,
94 ) -> PyRef<PyMethodDescriptor>
95 where
96 F: IntoPyNativeFn<FKind>,
97 {
98 let def = self
99 .ctx
100 .new_method_def(name, f, PyMethodFlags::METHOD, None);
101 def.build_method(class, self)
102 }
103
104 /// Instantiate an exception with arguments.
105 /// This function should only be used with builtin exception types; if a user-defined exception

Callers 1

make_stdout_objectFunction · 0.45

Calls 2

new_method_defMethod · 0.80
build_methodMethod · 0.80

Tested by

no test coverage detected