Struct glib::send_unique::SendUniqueCell
source · [−]pub struct SendUniqueCell<T: SendUnique> { /* private fields */ }
Expand description
Allows sending reference counted objects that don’t implement Send
to other threads
as long as only a single reference to the object exists.
Implementations
sourceimpl<T: SendUnique> SendUniqueCell<T>
impl<T: SendUnique> SendUniqueCell<T>
sourcepub fn new(obj: T) -> Result<Self, T>
pub fn new(obj: T) -> Result<Self, T>
Create a new SendUniqueCell
out of obj
Fails if obj
is not unique at this time
sourcepub fn borrow(&self) -> Ref<'_, T>
pub fn borrow(&self) -> Ref<'_, T>
Borrow the contained object or panic if borrowing is not possible at this time
sourcepub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
Try borrowing the contained object
Borrowing is possible as long as only a single reference to the object exists, or it is borrowed from the same thread currently
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extract the contained object or panic if it is not possible at this time
sourcepub fn try_into_inner(self) -> Result<T, Self>
pub fn try_into_inner(self) -> Result<T, Self>
Try extracting the contained object
Borrowing is possible as long as only a single reference to the object exists, or it is borrowed from the same thread currently
Trait Implementations
sourceimpl<T: Debug + SendUnique> Debug for SendUniqueCell<T>
impl<T: Debug + SendUnique> Debug for SendUniqueCell<T>
impl<T: SendUnique> Send for SendUniqueCell<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for SendUniqueCell<T>
impl<T> !Sync for SendUniqueCell<T>
impl<T> Unpin for SendUniqueCell<T> where
T: Unpin,
impl<T> UnwindSafe for SendUniqueCell<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more