pub struct RefCounted<T: ?Sized + 'static> { /* private fields */ }Expand description
An explicitly counted reference to a shared resource.
Every reference is disposed on its own; the resource is released when the last one is disposed. A reference that is dropped without having been disposed releases its count as well.
References are shared between the UI thread and the render thread: the count is atomic, as in the original.
Implementations§
Source§impl<T: ?Sized + 'static> RefCounted<T>
impl<T: ?Sized + 'static> RefCounted<T>
Sourcepub fn item(&self) -> Arc<T> ⓘ
pub fn item(&self) -> Arc<T> ⓘ
The referenced resource. Panics if this reference has been disposed.
Sourcepub fn clone_ref(&self) -> RefCounted<T>
pub fn clone_ref(&self) -> RefCounted<T>
Creates another reference to the resource. Panics if this reference has been disposed.
Trait Implementations§
Source§impl<T: ?Sized + 'static> Drop for RefCounted<T>
impl<T: ?Sized + 'static> Drop for RefCounted<T>
Auto Trait Implementations§
impl<T> !Freeze for RefCounted<T>
impl<T> RefUnwindSafe for RefCounted<T>
impl<T> Send for RefCounted<T>
impl<T> Sync for RefCounted<T>
impl<T> Unpin for RefCounted<T>
impl<T> UnsafeUnpin for RefCounted<T>
impl<T> UnwindSafe for RefCounted<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more