Skip to content

struct

Owner

pub struct Owner {
    /* private fields */
}

Owns the effects created inside [Owner::run], keeping them alive until [Owner::dispose]. Components use an owner to tie effects to their lifetime.

Methods

new

pub fn new() -> Self

Create an empty owner.

run

pub fn run<R>(&self, f: impl FnOnce() -> R) -> R

Run f with this owner adopting every effect created inside it.

effect_count

pub fn effect_count(&self) -> usize

Number of effects currently owned.

dispose

pub fn dispose(&self)

Dispose every owned effect and run the cleanups registered with on_cleanup.

Trait implementations