Struct cpython::PyBool [−][src]
pub struct PyBool(_);
Represents a Python bool.
Methods
impl PyBool[src]
impl PyBoolpub fn get(py: Python, val: bool) -> PyBool[src]
pub fn get(py: Python, val: bool) -> PyBoolDepending on val, returns py.True() or py.False().
pub fn is_true(&self) -> bool[src]
pub fn is_true(&self) -> boolGets whether this boolean is true.
Trait Implementations
impl ToPyObject for PyBool[src]
impl ToPyObject for PyBoolIdentity conversion: allows using existing PyObject instances where
T: ToPyObject is expected.
type ObjectType = PyBool
fn to_py_object(&self, py: Python) -> PyBool[src]
fn to_py_object(&self, py: Python) -> PyBoolConverts self into a Python object.
fn into_py_object(self, _py: Python) -> PyBool[src]
fn into_py_object(self, _py: Python) -> PyBoolConverts self into a Python object. Read more
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, [src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
impl<'source> FromPyObject<'source> for PyBool[src]
impl<'source> FromPyObject<'source> for PyBoolfn extract(py: Python, obj: &'source PyObject) -> PyResult<PyBool>[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<PyBool>Extracts Self from the source PyObject.
impl<'source> FromPyObject<'source> for &'source PyBool[src]
impl<'source> FromPyObject<'source> for &'source PyBoolfn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyBool>[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyBool>Extracts Self from the source PyObject.
impl PythonObject for PyBool[src]
impl PythonObject for PyBoolfn as_object(&self) -> &PyObject[src]
fn as_object(&self) -> &PyObjectCasts the Python object to PyObject.
fn into_object(self) -> PyObject[src]
fn into_object(self) -> PyObjectCasts the Python object to PyObject.
unsafe fn unchecked_downcast_from(obj: PyObject) -> Self[src]
unsafe fn unchecked_downcast_from(obj: PyObject) -> SelfUnchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
ⓘImportant traits for &'a mut Runsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a Self[src]
unsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a SelfUnchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
impl PythonObjectWithCheckedDowncast for PyBool[src]
impl PythonObjectWithCheckedDowncast for PyBoolfn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyBool, PythonObjectDowncastError<'p>>[src]
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyBool, PythonObjectDowncastError<'p>>Cast from PyObject to a concrete Python object type.
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyBool, PythonObjectDowncastError<'p>>[src]
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyBool, PythonObjectDowncastError<'p>>Cast from PyObject to a concrete Python object type.
impl PythonObjectWithTypeObject for PyBool[src]
impl PythonObjectWithTypeObject for PyBoolfn type_object(py: Python) -> PyType[src]
fn type_object(py: Python) -> PyTypeRetrieves the type object for this Python object type.