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

Convenience function that returns a new strongly referenced component if some other instance still holds a strong reference and the current thread is the thread that created this component. Otherwise, this function panics.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.