Struct cpython::PySharedRef[][src]

pub struct PySharedRef<'a, T: 'a + ?Sized> { /* fields omitted */ }

A reference to PySharedRefCell owned by a Python object.

This is a lifetime-bound reference to the PySharedRefCell data field, and will be created by the automatically generated accessor function.

impl MyType {
    fn data_name<'a>(&'a self, py: Python<'a>) -> PySharedRef<'a, T> { ... }
}

Implementations

impl<'a, T: ?Sized> PySharedRef<'a, T>[src]

pub fn borrow(&self) -> Ref<'a, T>[src]

Immutably borrows the wrapped value.

Panics

Panics if the value is currently mutably borrowed.

pub fn try_borrow(&self) -> Result<Ref<'a, T>, BorrowError>[src]

Immutably borrows the wrapped value, returning an error if the value is currently mutably borrowed.

pub fn borrow_mut(&self) -> RefMut<'a, T>[src]

Mutably borrows the wrapped value.

Any existing leaked references will be invalidated.

Panics

Panics if the value is currently borrowed.

pub fn try_borrow_mut(&self) -> Result<RefMut<'a, T>, BorrowMutError>[src]

Mutably borrows the wrapped value, returning an error if the value is currently borrowed.

pub fn leak_immutable(&self) -> UnsafePyLeaked<&'static T>[src]

Creates an immutable reference which is not bound to lifetime.

Panics

Panics if the value is currently mutably borrowed.

pub fn try_leak_immutable(
    &self
) -> Result<UnsafePyLeaked<&'static T>, BorrowError>
[src]

Creates an immutable reference which is not bound to lifetime, returning an error if the value is currently mutably borrowed.

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for PySharedRef<'a, T>[src]

impl<'a, T> !Send for PySharedRef<'a, T>[src]

impl<'a, T> !Sync for PySharedRef<'a, T>[src]

impl<'a, T: ?Sized> Unpin for PySharedRef<'a, T>[src]

impl<'a, T> !UnwindSafe for PySharedRef<'a, T>[src]

Blanket Implementations

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

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

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

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

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

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.

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.