Module rustypy::pytypes::pybool
[−]
[src]
Analog to a Python boolean type.
It supports & and | operators, and comparison to Rust bool types.
To return to Python use the as_ptr
method and return a raw pointer.
Safety
You can convert a raw pointer to a bool type with from_ptr_into_bool
method,
or to a &PyBool
with from_ptr
method. Those operations are unsafe as they require
dereferencing a raw pointer.
Examples
use rustypy::PyBool; let pybool = PyBool::from(true); assert_eq!(pybool, true); // prepare to return to Python: let ptr = pybool.as_ptr(); // convert from raw pointer to a bool let rust_bool = unsafe { PyBool::from_ptr_into_bool(ptr) };
Structs
PyBool |
Analog to a Python boolean type. |