pub struct IndexRefreshHandle { /* private fields */ }Expand description
What: Represent one caller-supplied background official-index refresh.
Inputs:
- Created by
spawn_index_refreshfrom a future that produces anOfficialIndexor a structured toolkit error.
Output:
- A handle that can cancel pending async work and explicitly await its result/error delivery.
Details:
- This handle owns no global index and performs no system mutation.
- Cancellation aborts the async task; cooperative futures such as caller HTTP requests are dropped promptly, while caller code still owns any external resource semantics.
Implementations§
Source§impl IndexRefreshHandle
impl IndexRefreshHandle
Sourcepub fn cancel(&self)
pub fn cancel(&self)
What: Request cancellation of a pending background refresh.
Inputs: None.
Output:
- Requests task abortion;
Self::waitreports a structured cancelled error if the task did not complete first.
Details:
- Cancellation is idempotent and does not block the calling thread.
- It is meaningful for async futures; callers should not wrap a
non-cancellable
spawn_blockingoperation in this API and expect it to stop after it has started.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
What: Check whether the refresh task has completed.
Inputs: None.
Output:
trueafter successful, failed, panicked, or cancelled completion.
Details:
- This is an observation only; use
Self::waitfor explicit result or error delivery.
Sourcepub async fn wait(self) -> Result<OfficialIndex>
pub async fn wait(self) -> Result<OfficialIndex>
What: Await the background refresh result and deliver task failures explicitly.
Inputs:
self: Consumes the handle and awaits the owned task.
Output:
- Refreshed
OfficialIndexor the refresh/task/cancellation error.
Details:
- A cancelled task maps to an actionable parse error instead of silently returning an empty index. Panics and runtime failures also remain visible to the caller.
§Errors
Returns the caller future’s error or a descriptive task failure mapped to
ArchToolkitError::Parse.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexRefreshHandle
impl RefUnwindSafe for IndexRefreshHandle
impl Send for IndexRefreshHandle
impl Sync for IndexRefreshHandle
impl Unpin for IndexRefreshHandle
impl UnsafeUnpin for IndexRefreshHandle
impl UnwindSafe for IndexRefreshHandle
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