pub struct QueryOptions { /* private fields */ }
Expand description
Configuration to be used with crate::QueryClient
and individual query scopes.
Implementations§
Source§impl QueryOptions
impl QueryOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new QueryOptions
with default values.
Sourcepub fn with_stale_time(self, stale_time: Duration) -> Self
pub fn with_stale_time(self, stale_time: Duration) -> Self
Set the duration that should pass before a query is considered stale.
Once stale, after any new interaction with the query, a new resource using it, declarative interactions etc, the query will be refetched in the background, and update active resources.
Default: never
Sourcepub fn with_gc_time(self, gc_time: Duration) -> Self
pub fn with_gc_time(self, gc_time: Duration) -> Self
Set the duration that should pass before an unused query is garbage collected.
After this time, if the query isn’t being used by any resources, the query will be removed from the cache, to minimise the cache’s size. If the query is in active use, the gc will be scheduled to check again after the same time interval.
To never garbage collect, set std::time::Duration::MAX
.
Default: 5 minutes
Sourcepub fn with_refetch_interval(self, refetch_interval: Duration) -> Self
pub fn with_refetch_interval(self, refetch_interval: Duration) -> Self
Set the interval after which to automatically refetch the query if there are any active resources.
If the query is being used by any resources, it will be invalidated and refetched in the background, updating active resources according to this interval.
Default: No refetching
Sourcepub fn stale_time(&self) -> Duration
pub fn stale_time(&self) -> Duration
The duration that should pass before a query is considered stale.
Once stale, after any new interaction with the query, a new resource using it, declarative interactions etc, the query will be refetched in the background, and update active resources.
Default: never
Sourcepub fn gc_time(&self) -> Duration
pub fn gc_time(&self) -> Duration
The duration that should pass before an unused query is garbage collected.
After this time, if the query isn’t being used by any resources, the query will be removed from the cache, to minimise the cache’s size. If the query is in active use, the gc will be scheduled to check again after the same time interval.
Default: 5 minutes
Sourcepub fn refetch_interval(&self) -> Option<Duration>
pub fn refetch_interval(&self) -> Option<Duration>
The interval (if any) after which to automatically refetch the query if there are any active resources.
If the query is being used by any resources, it will be invalidated and refetched in the background, updating active resources according to this interval.
Default: No refetching
Trait Implementations§
Source§impl Clone for QueryOptions
impl Clone for QueryOptions
Source§fn clone(&self) -> QueryOptions
fn clone(&self) -> QueryOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for QueryOptions
impl Debug for QueryOptions
Source§impl Default for QueryOptions
impl Default for QueryOptions
Source§fn default() -> QueryOptions
fn default() -> QueryOptions
Source§impl Hash for QueryOptions
impl Hash for QueryOptions
impl Copy for QueryOptions
Auto Trait Implementations§
impl Freeze for QueryOptions
impl RefUnwindSafe for QueryOptions
impl Send for QueryOptions
impl Sync for QueryOptions
impl Unpin for QueryOptions
impl UnwindSafe for QueryOptions
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.