# pyo3::pycell::PyRefMut - Rust
Wraps a mutable borrowed reference to a value in a `PyCell<T>`.
Keywords: rust, rustlang, rust-lang, PyRefMut

# Struct pyo3::pycell::PyRefMut [−] [src]

    pub struct PyRefMut<'p, T: PyClass> { /* fields omitted */ }

Wraps a mutable borrowed reference to a value in a `PyCell<T>`.

See the `PyCell` and `PyRef` documentations for more.

## Implementations

### `impl<'p, T: PyClass> PyRefMut<'p, T>` [src]

#### `pub fn py(&self) -> Python<'_>` [src]

Returns `Python` token. This function is safe since PyRefMut has the same lifetime as a `GILGuard`.

### `impl<'p, T, U> PyRefMut<'p, T> where
T: PyClass + PyTypeInfo<BaseType = U, BaseLayout = PyCellInner<U>>,
U: PyClass,` [src]

#### `pub fn into_super(self) -> PyRefMut<'p, U>` [src]

Get `PyRef<T::BaseType>`. See `PyRef::into_super` for more.

## Trait Implementations

### `impl<'p, T, U> AsMut<U> for PyRefMut<'p, T> where
T: PyClass + PyTypeInfo<BaseType = U, BaseLayout = PyCellInner<U>>,
U: PyClass,` [src]

#### `fn as_mut(&mut self) -> &mut T::BaseType` [src]

Performs the conversion.

### `impl<'a, T: PyClass> AsPyPointer for PyRefMut<'a, T>` [src]

#### `fn as_ptr(&self) -> *mut PyObject` [src]

Retrieves the underlying FFI pointer (as a borrowed pointer).

### `impl<'p, T, U> AsRef<U> for PyRefMut<'p, T> where
T: PyClass + PyTypeInfo<BaseType = U, BaseLayout = PyCellInner<U>>,
U: PyClass,` [src]

#### `fn as_ref(&self) -> &T::BaseType` [src]

Performs the conversion.

### `impl<T: PyClass + Debug> Debug for PyRefMut<'_, T>` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl<'p, T: PyClass> Deref for PyRefMut<'p, T>` [src]

#### `type Target = T`

The resulting type after dereferencing.

#### `fn deref(&self) -> &T` [src]

Dereferences the value.

### `impl<'p, T: PyClass> DerefMut for PyRefMut<'p, T>` [src]

#### `fn deref_mut(&mut self) -> &mut T` [src]

Mutably dereferences the value.

### `impl<'p, T: PyClass> Drop for PyRefMut<'p, T>` [src]

#### `fn drop(&mut self)` [src]

Executes the destructor for this type. Read more

### `impl<'a, T> From<PyRefMut<'a, T>> for Py<T> where
T: PyClass,` [src]

#### `fn from(pyref: PyRefMut<'a, T>) -> Self` [src]

Performs the conversion.

### `impl<'a, T> FromPyObject<'a> for PyRefMut<'a, T> where
T: PyClass,` [src]

#### `fn extract(obj: &'a PyAny) -> PyResult<Self>` [src]

Extracts `Self` from the source `PyObject`.

### `impl<T: PyClass> IntoPy<Py<PyAny>> for PyRefMut<'_, T>` [src]

#### `fn into_py(self, py: Python<'_>) -> PyObject` [src]

Performs the conversion.

### `impl<'a, T: PyClass> TryFrom<&'a PyCell<T>> for PyRefMut<'a, T>` [src]

#### `type Error = PyBorrowMutError`

The type returned in the event of a conversion error.

#### `fn try_from(cell: &'a PyCell<T>) -> Result<Self, Self::Error>` [src]

Performs the conversion.

## Auto Trait Implementations

### `impl<'p, T> !RefUnwindSafe for PyRefMut<'p, T>`

### `impl<'p, T> !Send for PyRefMut<'p, T>`

### `impl<'p, T> !Sync for PyRefMut<'p, T>`

### `impl<'p, T> Unpin for PyRefMut<'p, T>`

### `impl<'p, T> !UnwindSafe for PyRefMut<'p, T>`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.