pub struct WeakHandle { /* private fields */ }Expand description
Handle to an artifact that does not prevent the artifact from being unloaded.
Weak handles are primarily used when you want to use something that is already loaded.
For example, a strong handle to an artifact may be guaranteed to exist elsewhere in the program, and so you can simply get and use a weak handle to that artifact in other parts of your code. This removes reference counting overhead, but also ensures that the system which uses the weak handle is not in control of when to unload the artifact.
Implementations§
Source§impl WeakHandle
impl WeakHandle
pub fn new(handle: Arc<ResolvedLoadHandle>) -> Self
Trait Implementations§
Source§impl ArtifactHandle for WeakHandle
impl ArtifactHandle for WeakHandle
fn resolved_load_handle(&self) -> &Arc<ResolvedLoadHandle>
Source§fn load_state<T: LoadStateProvider>(&self, loader: &T) -> LoadState
fn load_state<T: LoadStateProvider>(&self, loader: &T) -> LoadState
Returns the load status of the artifact. Read more
fn artifact_id<T: LoadStateProvider>(&self, loader: &T) -> ArtifactId
Source§fn artifact<'a, T, S: TypedArtifactStorage<T>>(
&self,
storage: &'a S,
) -> Option<&'a T>where
Self: Sized,
fn artifact<'a, T, S: TypedArtifactStorage<T>>(
&self,
storage: &'a S,
) -> Option<&'a T>where
Self: Sized,
Returns an immutable reference to the artifact if it is committed. Read more
Source§fn downgrade(&self) -> WeakHandle
fn downgrade(&self) -> WeakHandle
Downgrades this handle into a
WeakHandle. Read moreSource§fn load_handle(&self) -> LoadHandle
fn load_handle(&self) -> LoadHandle
Returns the
LoadHandle of this artifact handle.fn direct_load_handle(&self) -> LoadHandle
Source§impl Clone for WeakHandle
impl Clone for WeakHandle
Source§fn clone(&self) -> WeakHandle
fn clone(&self) -> WeakHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WeakHandle
impl Debug for WeakHandle
Source§impl Hash for WeakHandle
impl Hash for WeakHandle
Source§impl PartialEq for WeakHandle
impl PartialEq for WeakHandle
impl Eq for WeakHandle
impl StructuralPartialEq for WeakHandle
Auto Trait Implementations§
impl Freeze for WeakHandle
impl RefUnwindSafe for WeakHandle
impl Send for WeakHandle
impl Sync for WeakHandle
impl Unpin for WeakHandle
impl UnwindSafe for WeakHandle
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