pub struct Scope(/* private fields */);
Expand description
You can manually control Signal’s lifetime by using Scope.
Every Signal has a Scope created explicitly or implicitly, and when you Dispose the Scope, it will clean up all the Signals that belong to the Scope and all the child Scopes
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn current() -> Scope
pub fn current() -> Scope
The current Scope in the Runtime. Any Signal/Effect/Memo created with implicitly Scope will be under this Scope
Sourcepub fn create_child(&self) -> Scope
pub fn create_child(&self) -> Scope
Create a child Scope of this Scope
Sourcepub fn create_signal<T>(self, value: T) -> (ReadSignal<T>, WriteSignal<T>)where
T: Any + 'static,
pub fn create_signal<T>(self, value: T) -> (ReadSignal<T>, WriteSignal<T>)where
T: Any + 'static,
Create a new Signal under this Scope
Sourcepub fn create_rw_signal<T>(self, value: T) -> RwSignal<T>where
T: Any + 'static,
pub fn create_rw_signal<T>(self, value: T) -> RwSignal<T>where
T: Any + 'static,
Create a RwSignal under this Scope
Sourcepub fn create_memo<T>(self, f: impl Fn(Option<&T>) -> T + 'static) -> Memo<T>where
T: PartialEq + 'static,
pub fn create_memo<T>(self, f: impl Fn(Option<&T>) -> T + 'static) -> Memo<T>where
T: PartialEq + 'static,
Create a Memo under this Scope
Sourcepub fn create_trigger(self) -> Trigger
pub fn create_trigger(self) -> Trigger
Create a Trigger under this Scope
Sourcepub fn create_effect<T>(self, f: impl Fn(Option<T>) -> T + 'static)where
T: Any + 'static,
pub fn create_effect<T>(self, f: impl Fn(Option<T>) -> T + 'static)where
T: Any + 'static,
Create effect under this Scope
Sourcepub fn create_updater<R>(
self,
compute: impl Fn() -> R + 'static,
on_change: impl Fn(R) + 'static,
) -> Rwhere
R: 'static,
pub fn create_updater<R>(
self,
compute: impl Fn() -> R + 'static,
on_change: impl Fn(R) + 'static,
) -> Rwhere
R: 'static,
Create updater under this Scope
Trait Implementations§
impl Copy for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnwindSafe for Scope
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