pub struct UseCacheUpdate {
pub doc_status: Signal<bool>,
pub version: Signal<String>,
pub updating: Signal<bool>,
}Expand description
Reactive state for the cache update feature.
Tracks the documentation build status, the latest version string, and whether a cache update is currently in progress.
Fields§
§doc_status: Signal<bool>Whether the docs.rs build status indicates documentation is available.
version: Signal<String>The latest version string returned by docs.rs.
updating: Signal<bool>Whether a cache update operation is currently in progress.
Implementations§
Source§impl UseCacheUpdate
Implementation of cache update functionality.
impl UseCacheUpdate
Implementation of cache update functionality.
Sourcepub fn use_cache_state() -> UseCacheUpdate
pub fn use_cache_state() -> UseCacheUpdate
Creates cache update state for tracking documentation build status.
Initializes doc_status to false, version to an empty string,
and updating to false. The actual data is loaded asynchronously
via Self::load.
§Returns
UseCacheUpdate: The cache update state.
Sourcepub fn load<F, Fut>(self, updater: F)
pub fn load<F, Fut>(self, updater: F)
Runs the provided updater closure and applies its result to the internal state signals.
The closure is called asynchronously via spawn_local. It receives
no arguments and must return a Future<Output = UpdateResult>.
Once it resolves, the doc_status, version, and updating
signals are updated from the returned UpdateResult.
The UI layer is completely unaware of how the update check is performed (fetch, version comparison, bridge invocation, etc.) — it only sees the result.
§Arguments
F: An async closure that returnsUpdateResult.
Source§impl UseCacheUpdate
impl UseCacheUpdate
pub fn get_doc_status(&self) -> Signal<bool>
pub fn get_mut_doc_status(&mut self) -> &mut Signal<bool>
pub fn set_doc_status(&mut self, val: Signal<bool>) -> &mut Self
pub fn get_version(&self) -> Signal<String>
pub fn get_mut_version(&mut self) -> &mut Signal<String>
pub fn set_version(&mut self, val: Signal<String>) -> &mut Self
pub fn get_updating(&self) -> Signal<bool>
pub fn get_mut_updating(&mut self) -> &mut Signal<bool>
pub fn set_updating(&mut self, val: Signal<bool>) -> &mut Self
Trait Implementations§
Source§impl Clone for UseCacheUpdate
impl Clone for UseCacheUpdate
Source§fn clone(&self) -> UseCacheUpdate
fn clone(&self) -> UseCacheUpdate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more