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

Method with_borrowed_ptr

src/objects/boolobject.rs:40–52  ·  view source on GitHub ↗
(&self, _py: Python, f: F)

Source from the content-addressed store, hash-verified

38
39 #[inline]
40 fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R
41 where
42 F: FnOnce(*mut ffi::PyObject) -> R,
43 {
44 // Avoid unnecessary Py_INCREF/Py_DECREF pair
45 f(unsafe {
46 if *self {
47 ffi::Py_True()
48 } else {
49 ffi::Py_False()
50 }
51 })
52 }
53}
54
55extract!(obj to bool;

Callers 15

addMethod · 0.45
subtractMethod · 0.45
multiplyMethod · 0.45
matrix_multiplyMethod · 0.45
power_moduloMethod · 0.45
true_divideMethod · 0.45
floor_divideMethod · 0.45
moduloMethod · 0.45
div_modMethod · 0.45
left_shiftMethod · 0.45
right_shiftMethod · 0.45
bitwise_andMethod · 0.45

Calls 3

fFunction · 0.85
Py_TrueFunction · 0.50
Py_FalseFunction · 0.50

Tested by

no test coverage detected