Skip to main content

ProgressParams

Struct ProgressParams 

Source
pub struct ProgressParams {
    pub channel: Uri,
    pub progress_token: String,
    pub progress: i64,
    pub total: Option<i64>,
    pub message: Option<String>,
}
Expand description

Generic progress notification for a long-running operation.

A client opts in to progress for a request by including a progressToken in that request (today: the progressToken field on createSession). If the server does long-running work to service the request — e.g. lazily downloading an agent’s native SDK the first time a session of that provider is materialized — it emits progress notifications carrying the same token.

The notification is operation-agnostic: it says nothing about what is progressing. The client correlates progressToken back to the request it originated from (and thus the UI surface awaiting it) and renders its own localized indicator. The same channel serves any future long-running operation without a new method.

Semantics:

  • progress is monotonically non-decreasing for a given progressToken.
  • total is present only when the server knows the magnitude up front (e.g. a Content-Length); when absent the client SHOULD show an indeterminate indicator.
  • The operation is complete when progress === total. The server MUST emit a final frame satisfying progress === total; when the total was never known, it sets total to the final progress on that frame. No further frames reference the token afterwards.
  • The server MAY emit no progress at all (e.g. the work was already done); the client then never shows an indicator.
  • Like all notifications this is ephemeral and is not replayed on reconnect. A client that never receives the terminal frame SHOULD expire the indicator after an idle timeout.

Fields§

§channel: Uri

Channel URI this notification belongs to (the root channel).

§progress_token: String

Echoes the progressToken the client supplied on the originating request (e.g. the progressToken field of createSession), correlating this frame to that call. Unique across the client’s active requests.

§progress: i64

Progress so far, in operation-defined units (e.g. bytes received). Monotonically non-decreasing for a given progressToken.

§total: Option<i64>

Total when known up front (e.g. from a Content-Length); omitted ⇒ indeterminate. The operation is complete once progress === total.

§message: Option<String>

Optional human-readable progress message. The client owns its own (localized) presentation derived from the originating request; generic clients that don’t track the token MAY display this instead.

Trait Implementations§

Source§

impl Clone for ProgressParams

Source§

fn clone(&self) -> ProgressParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProgressParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProgressParams

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ProgressParams

Source§

fn eq(&self, other: &ProgressParams) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ProgressParams

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProgressParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.