[−][src]Struct pyo3::PyRefMut
Mutable version of PyRef
.
Example
use pyo3::prelude::*; use pyo3::types::IntoPyDict; #[pyclass] struct Point { x: i32, y: i32, } #[pymethods] impl Point { fn length(&self) -> i32 { self.x * self.y } } let gil = Python::acquire_gil(); let py = gil.python(); let mut obj = PyRefMut::new(gil.python(), Point { x: 3, y: 4 }).unwrap(); let d = vec![("p", obj.to_object(py))].into_py_dict(py); obj.x = 5; obj.y = 20; py.run("assert p.length() == 100", None, Some(d)).unwrap();
Methods
impl<'p, T> PyRefMut<'p, T> where
T: PyTypeInfo + PyTypeObject + PyTypeCreate,
[src]
T: PyTypeInfo + PyTypeObject + PyTypeCreate,
Trait Implementations
impl<'a, T: PyTypeInfo> AsPyPointer for PyRefMut<'a, T>
[src]
impl<'a, T: PyTypeInfo> ToPyObject for PyRefMut<'a, T>
[src]
impl<'p, T> FromPyPointer<'p> for PyRefMut<'p, T> where
T: PyTypeInfo,
[src]
T: PyTypeInfo,
unsafe fn from_owned_ptr_or_opt(
py: Python<'p>,
ptr: *mut PyObject
) -> Option<Self>
[src]
py: Python<'p>,
ptr: *mut PyObject
) -> Option<Self>
unsafe fn from_borrowed_ptr_or_opt(
py: Python<'p>,
ptr: *mut PyObject
) -> Option<Self>
[src]
py: Python<'p>,
ptr: *mut PyObject
) -> Option<Self>
unsafe fn from_owned_ptr_or_panic(py: Python<'p>, ptr: *mut PyObject) -> Self
[src]
unsafe fn from_owned_ptr(py: Python<'p>, ptr: *mut PyObject) -> Self
[src]
unsafe fn from_owned_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<Self>
[src]
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<Self>
unsafe fn from_borrowed_ptr_or_panic(py: Python<'p>, ptr: *mut PyObject) -> Self
[src]
unsafe fn from_borrowed_ptr(py: Python<'p>, ptr: *mut PyObject) -> Self
[src]
unsafe fn from_borrowed_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<Self>
[src]
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<Self>
impl<'a, T> From<PyRefMut<'a, T>> for Py<T> where
T: PyTypeInfo,
[src]
T: PyTypeInfo,
impl<'a, T> From<PyRefMut<'a, T>> for &'a PyAny where
T: PyTypeInfo,
[src]
T: PyTypeInfo,
impl<'a, T: PyTypeInfo> DerefMut for PyRefMut<'a, T>
[src]
impl<'a, T: PyTypeInfo> Deref for PyRefMut<'a, T>
[src]
impl<'a, T: Debug + PyTypeInfo> Debug for PyRefMut<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> Unpin for PyRefMut<'a, T>
impl<'a, T> !Sync for PyRefMut<'a, T>
impl<'a, T> !Send for PyRefMut<'a, T>
impl<'a, T> !RefUnwindSafe for PyRefMut<'a, T>
impl<'a, T> !UnwindSafe for PyRefMut<'a, T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,