Struct sixtyfps::Weak [−][src]
pub struct Weak<T: ComponentHandle> { /* fields omitted */ }
Expand description
Struct that’s used to hold weak references of SixtyFPS component
In order to create a Weak, you should use ComponentHandle::as_weak
.
Strong references should not be captured by the functions given to a lambda, as this would produce a reference loop and leak the component. Instead, the callback function should capture a weak component.
The Weak component also implement Send
and can be send to another thread.
but the upgrade function will only return a valid component from the same thread
as the one it has been created from.
This is useful to use with invoke_from_event_loop()
.
Implementations
Returns a new strongly referenced component if some other instance still holds a strong reference. Otherwise, returns None.
This also returns None if the current thread is not the thread that created the component
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Weak<T> where
<T as ComponentHandle>::Inner: RefUnwindSafe,
impl<T> UnwindSafe for Weak<T> where
<T as ComponentHandle>::Inner: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more