Struct PyRefMut
pub struct PyRefMut<'p, T>where
T: PyClass<Frozen = False>,{ /* private fields */ }tls only.Expand description
A wrapper type for a mutably borrowed value from a Bound<'py, T>.
See the module-level documentation for more information.
Implementations§
§impl<'py, T> PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
impl<'py, T> PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
pub fn as_ptr(&self) -> *mut PyObject
pub fn as_ptr(&self) -> *mut PyObject
Returns the raw FFI pointer represented by self.
§Safety
Callers are responsible for ensuring that the pointer does not outlive self.
The reference is borrowed; callers should not decrease the reference count when they are finished with the pointer.
pub fn into_ptr(self) -> *mut PyObject
pub fn into_ptr(self) -> *mut PyObject
Returns an owned raw FFI pointer represented by self.
§Safety
The reference is owned; when finished the caller should either transfer ownership
of the pointer or decrease the reference count (e.g. with pyo3::ffi::Py_DecRef).
§impl<'p, T> PyRefMut<'p, T>
impl<'p, T> PyRefMut<'p, T>
pub fn into_super(self) -> PyRefMut<'p, <T as PyClassImpl>::BaseType>
pub fn into_super(self) -> PyRefMut<'p, <T as PyClassImpl>::BaseType>
Gets a PyRef<T::BaseType>.
See PyRef::into_super for more.
pub fn as_super(&mut self) -> &mut PyRefMut<'p, <T as PyClassImpl>::BaseType>
pub fn as_super(&mut self) -> &mut PyRefMut<'p, <T as PyClassImpl>::BaseType>
Borrows a mutable reference to PyRefMut<T::BaseType>.
With the help of this method, you can mutate attributes and call mutating
methods on the superclass without consuming the PyRefMut<T>. This method
can also be chained to access the super-superclass (and so on).
See PyRef::as_super for more.
Trait Implementations§
§impl<'a, 'py, T> FromPyObject<'a, 'py> for PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
impl<'a, 'py, T> FromPyObject<'a, 'py> for PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
§impl<'py, T> IntoPyObject<'py> for PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
impl<'py, T> IntoPyObject<'py> for PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
§type Error = Infallible
type Error = Infallible
§fn into_pyobject(
self,
_py: Python<'py>,
) -> Result<<PyRefMut<'py, T> as IntoPyObject<'py>>::Output, <PyRefMut<'py, T> as IntoPyObject<'py>>::Error>
fn into_pyobject( self, _py: Python<'py>, ) -> Result<<PyRefMut<'py, T> as IntoPyObject<'py>>::Output, <PyRefMut<'py, T> as IntoPyObject<'py>>::Error>
§impl<'a, 'py, T> IntoPyObject<'py> for &'a PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
impl<'a, 'py, T> IntoPyObject<'py> for &'a PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
§type Error = Infallible
type Error = Infallible
§fn into_pyobject(
self,
_py: Python<'py>,
) -> Result<<&'a PyRefMut<'py, T> as IntoPyObject<'py>>::Output, <&'a PyRefMut<'py, T> as IntoPyObject<'py>>::Error>
fn into_pyobject( self, _py: Python<'py>, ) -> Result<<&'a PyRefMut<'py, T> as IntoPyObject<'py>>::Output, <&'a PyRefMut<'py, T> as IntoPyObject<'py>>::Error>
Auto Trait Implementations§
impl<'p, T> !Send for PyRefMut<'p, T>
impl<'p, T> !Sync for PyRefMut<'p, T>
impl<'p, T> Freeze for PyRefMut<'p, T>
impl<'p, T> RefUnwindSafe for PyRefMut<'p, T>where
T: RefUnwindSafe,
impl<'p, T> Unpin for PyRefMut<'p, T>where
T: Unpin,
impl<'p, T> UnsafeUnpin for PyRefMut<'p, T>
impl<'p, T> UnwindSafe for PyRefMut<'p, T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<R> CryptoRng for Rwhere
R: TryCryptoRng<Error = Infallible> + ?Sized,
impl<'py, T> FromPyObjectOwned<'py> for Twhere
T: for<'a> FromPyObject<'a, 'py>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<R> Rng for Rwhere
R: TryRng<Error = Infallible> + ?Sized,
impl<R> Rng for Rwhere
R: TryRng<Error = Infallible> + ?Sized,
impl<R> RngCore for Rwhere
R: Rng,
§impl<R> RngExt for Rwhere
R: Rng + ?Sized,
impl<R> RngExt for Rwhere
R: Rng + ?Sized,
§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read more§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘwhere
Self: Sized,
StandardUniform: Distribution<T>,
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘwhere
Self: Sized,
StandardUniform: Distribution<T>,
§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read more§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read more§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
impl<R> TryCryptoRng for R
§impl<R> TryRng for R
impl<R> TryRng for R
§type Error = <<R as Deref>::Target as TryRng>::Error
type Error = <<R as Deref>::Target as TryRng>::Error
§fn try_next_u32(&mut self) -> Result<u32, <R as TryRng>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRng>::Error>
u32.§fn try_next_u64(&mut self) -> Result<u64, <R as TryRng>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRng>::Error>
u64.§fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), <R as TryRng>::Error>
fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), <R as TryRng>::Error>
dst entirely with random data.