Struct cpython::PySharedRef [−][src]
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]
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]
&self
) -> Result<UnsafePyLeaked<&'static T>, BorrowError>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub 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>,