pub struct Tracker { /* private fields */ }Expand description
Tracks reactive subscriptions and automatically cleans them up when dropped.
Subscriptions registered with a Tracker will be automatically disposed when the Tracker is dropped, preventing memory leaks and ensuring proper cleanup.
Note: Tracker cannot be created directly. Use DisposableTracker::new() and
get the Tracker via .tracker().
Implementations§
Source§impl Tracker
impl Tracker
Sourcepub fn subscription_count(&self) -> usize
pub fn subscription_count(&self) -> usize
Returns the number of active subscriptions tracked.
Sourcepub fn track(&self, child: DisposableTracker)
pub fn track(&self, child: DisposableTracker)
Tracks another DisposableTracker’s lifetime.
When the Tracker’s parent DisposableTracker is disposed (either manually via dispose() or
automatically when dropped), the tracked DisposableTracker will also be disposed.
This is useful for creating hierarchical cleanup relationships.
§Arguments
child- The DisposableTracker to track
§Example
use rx_rs::core::DisposableTracker;
let parent = DisposableTracker::new();
let mut child = DisposableTracker::new();
parent.tracker().track(child);
// When parent is disposed, child is also disposedTrait Implementations§
Auto Trait Implementations§
impl Freeze for Tracker
impl !RefUnwindSafe for Tracker
impl !Send for Tracker
impl !Sync for Tracker
impl Unpin for Tracker
impl UnsafeUnpin for Tracker
impl !UnwindSafe for Tracker
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