pub struct CountQuery<M: Model> { /* private fields */ }Expand description
A live count over one model’s table, the badge query: SELECT COUNT(*) behind the same
dependency-gated staleness as Query, holding no id vector, so a count over a
million-row result costs O(1) memory. Clone shares the same state.
Implementations§
Source§impl<M: Model> CountQuery<M>
impl<M: Model> CountQuery<M>
Sourcepub fn error(&self) -> Signal<Option<DbError>>
pub fn error(&self) -> Signal<Option<DbError>>
The last read error, independently of the last successful count.
Sourcepub fn try_get(&self) -> Result<usize, DbError>
pub fn try_get(&self) -> Result<usize, DbError>
Checked count for operations that require a successful read.
§Errors
Returns the query’s error when its last read failed.
Sourcepub fn get(&self) -> usize
pub fn get(&self) -> usize
The count, as a tracked read: the caller re-runs when it changes, and only then.
Sourcepub fn get_untracked(&self) -> usize
pub fn get_untracked(&self) -> usize
Untracked snapshot: reactively silent, still current.
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for CountQuery<M>
impl<M> !Send for CountQuery<M>
impl<M> !Sync for CountQuery<M>
impl<M> !UnwindSafe for CountQuery<M>
impl<M> Forget for CountQuery<M>
impl<M> Freeze for CountQuery<M>
impl<M> Move for CountQuery<M>
impl<M> Unpin for CountQuery<M>
impl<M> UnsafeUnpin for CountQuery<M>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more