pub struct TrackingModel {
pub init_count: Arc<AtomicUsize>,
pub update_count: Arc<AtomicUsize>,
pub view_count: Arc<AtomicUsize>,
pub value: i32,
}Expand description
A test model that tracks lifecycle calls with atomic counters.
Useful for verifying that init/update/view are called the expected number of times.
Fields§
§init_count: Arc<AtomicUsize>Counter for init calls.
update_count: Arc<AtomicUsize>Counter for update calls.
view_count: Arc<AtomicUsize>Counter for view calls.
value: i32Internal state for testing.
Implementations§
Source§impl TrackingModel
impl TrackingModel
Sourcepub fn with_counters(
init_count: Arc<AtomicUsize>,
update_count: Arc<AtomicUsize>,
view_count: Arc<AtomicUsize>,
) -> Self
pub fn with_counters( init_count: Arc<AtomicUsize>, update_count: Arc<AtomicUsize>, view_count: Arc<AtomicUsize>, ) -> Self
Create a new tracking model with shared counters.
Sourcepub fn init_calls(&self) -> usize
pub fn init_calls(&self) -> usize
Get the current init count.
Sourcepub fn update_calls(&self) -> usize
pub fn update_calls(&self) -> usize
Get the current update count.
Sourcepub fn view_calls(&self) -> usize
pub fn view_calls(&self) -> usize
Get the current view count.
Trait Implementations§
Source§impl Default for TrackingModel
impl Default for TrackingModel
Source§impl Model for TrackingModel
impl Model for TrackingModel
Auto Trait Implementations§
impl Freeze for TrackingModel
impl RefUnwindSafe for TrackingModel
impl Send for TrackingModel
impl Sync for TrackingModel
impl Unpin for TrackingModel
impl UnwindSafe for TrackingModel
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