#[non_exhaustive]pub enum TaskPollDecision {
Terminal {
status: TaskStatus,
},
InProgress {
poll_hint: Option<u64>,
},
InputRequired,
}Expand description
The classification of a polled Task, derived purely from its
already-deserialized TaskStatus — the single decision primitive every
task poller consumes so the branch logic cannot drift.
Produced by Task::poll_decision. It answers the one question a poll loop
asks each tick: stop, ask the user, or sleep and poll again? — without a
network round-trip, a CallToolResult
fetch, or any I/O. It is a pure, replay-deterministic function of the polled
Task, so it is safe to call inside a memoized durable/replay step (D-01,
D-03).
§Non-exhaustive
This enum is #[non_exhaustive] for future-proofing (D-04): adding a variant
later is a non-breaking change, so external match sites must carry a
wildcard _ => arm. This is a distinct claim from TaskStatus, which is
deliberately exhaustive today (D-15): #[non_exhaustive] here does NOT
imply that unknown or future wire statuses are handled gracefully at runtime.
An unknown status fails at serde deserialization during tasks/get, BEFORE
classification ever runs — poll_decision() only ever sees one of the five
known TaskStatus values.
Unlike every other type in this module, TaskPollDecision intentionally
derives neither Serialize nor Deserialize: it is a returned classifier
value consumed in-process, never a wire type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Terminal
The task has reached a terminal status (TaskStatus::Completed,
TaskStatus::Failed, or TaskStatus::Cancelled) and will not
transition further — the poll loop should stop.
The classifier carries the terminal TaskStatus by value (it is
Copy) but deliberately does NOT carry the final
CallToolResult: to retrieve the
result the caller still issues a separate tasks/result call
(D-06/D-16). This keeps classification a pure, I/O-free decision.
Fields
status: TaskStatusThe terminal status that ended the task.
InProgress
The task is still running (TaskStatus::Working) — the poll loop
should sleep and poll again.
poll_hint is the raw server-reported pollInterval in milliseconds
(Task::poll_interval), passed through verbatim including None
(D-07). Feed it to resolve_poll_interval to obtain the concrete sleep
duration honoring the caller override, this hint, the default, and the
hot-loop floor.
Fields
InputRequired
The task is blocked on user input (TaskStatus::InputRequired).
This is a unit variant carrying no payload (D-05): the caller already
holds the polled Task, and a blocking poller cannot supply the input,
so it must route to elicitation rather than continue spinning.
Trait Implementations§
Source§impl Clone for TaskPollDecision
impl Clone for TaskPollDecision
Source§fn clone(&self) -> TaskPollDecision
fn clone(&self) -> TaskPollDecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskPollDecision
impl Debug for TaskPollDecision
impl Eq for TaskPollDecision
Source§impl PartialEq for TaskPollDecision
impl PartialEq for TaskPollDecision
impl StructuralPartialEq for TaskPollDecision
Auto Trait Implementations§
impl Freeze for TaskPollDecision
impl RefUnwindSafe for TaskPollDecision
impl Send for TaskPollDecision
impl Sync for TaskPollDecision
impl Unpin for TaskPollDecision
impl UnsafeUnpin for TaskPollDecision
impl UnwindSafe for TaskPollDecision
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.