Struct cpython::PyLong [−][src]
pub struct PyLong(_);
In Python 2.x, represents a Python long
object.
In Python 3.x, represents a Python int
object.
Both PyInt
and PyLong
refer to the same type on Python 3.x.
You can usually avoid directly working with this type by using ToPyObject and extract with the primitive Rust integer types.
Trait Implementations
impl ToPyObject for PyLong
[src]
impl ToPyObject for PyLong
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
type ObjectType = PyLong
fn to_py_object(&self, py: Python) -> PyLong
[src]
fn to_py_object(&self, py: Python) -> PyLong
Converts self into a Python object.
fn into_py_object(self, _py: Python) -> PyLong
[src]
fn into_py_object(self, _py: Python) -> PyLong
Converts 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 PyLong
[src]
impl<'source> FromPyObject<'source> for PyLong
fn extract(py: Python, obj: &'source PyObject) -> PyResult<PyLong>
[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<PyLong>
Extracts Self
from the source PyObject
.
impl<'source> FromPyObject<'source> for &'source PyLong
[src]
impl<'source> FromPyObject<'source> for &'source PyLong
fn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyLong>
[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyLong>
Extracts Self
from the source PyObject
.
impl PythonObject for PyLong
[src]
impl PythonObject for PyLong
fn as_object(&self) -> &PyObject
[src]
fn as_object(&self) -> &PyObject
Casts the Python object to PyObject.
fn into_object(self) -> PyObject
[src]
fn into_object(self) -> PyObject
Casts the Python object to PyObject.
unsafe fn unchecked_downcast_from(obj: PyObject) -> Self
[src]
unsafe fn unchecked_downcast_from(obj: PyObject) -> Self
Unchecked 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 Self
Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
impl PythonObjectWithCheckedDowncast for PyLong
[src]
impl PythonObjectWithCheckedDowncast for PyLong
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyLong, PythonObjectDowncastError<'p>>
[src]
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyLong, 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 PyLong, PythonObjectDowncastError<'p>>
[src]
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyLong, PythonObjectDowncastError<'p>>
Cast from PyObject to a concrete Python object type.
impl PythonObjectWithTypeObject for PyLong
[src]
impl PythonObjectWithTypeObject for PyLong
fn type_object(py: Python) -> PyType
[src]
fn type_object(py: Python) -> PyType
Retrieves the type object for this Python object type.