pub struct TaskContext { /* private fields */ }Expand description
What a task’s work runs with: input from the client through
tasks/update, cancellation, a status message.
Implementations§
Source§impl TaskContext
impl TaskContext
Sourcepub fn is_task(&self) -> bool
pub fn is_task(&self) -> bool
Whether this work runs as a task (else inline, the client not having declared the extension).
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the client cancelled the task.
Sourcepub fn status_message(&self, message: &str)
pub fn status_message(&self, message: &str)
Show message as the task’s statusMessage.
Sourcepub fn input(
&self,
request: InputRequired,
) -> Result<Vec<(String, String)>, TaskError>
pub fn input( &self, request: InputRequired, ) -> Result<Vec<(String, String)>, TaskError>
Ask the client for input and wait for all of it: the task shows
input_required with request’s requests until tasks/update has
answered every key; returns the answers (key, raw JSON). Keys must
be new for the task. Err(Cancelled) when the task is cancelled;
an error when the work runs inline (no tasks extension).
Auto Trait Implementations§
impl !RefUnwindSafe for TaskContext
impl !UnwindSafe for TaskContext
impl Freeze for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnsafeUnpin for TaskContext
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