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§
source§impl<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