pub struct ReadResourceResult {
pub meta: Option<ResultMetaObject>,
pub cache_scope: CacheScope,
pub contents: Vec<ReadResourceResultContentsItem>,
pub result_type: String,
pub ttl_ms: u64,
}Expand description
The result returned by the server for a ReadResourceRequestresources/read request.
Fields§
§meta: Option<ResultMetaObject>§cache_scope: CacheScopeIndicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
"public": The response does not contain user-specific data. Any client or intermediary (e.g., shared gateway, caching proxy) MAY cache the response and serve it across authorization contexts."private": The response MAY be cached and reused only within the same authorization context. Caches MUST NOT be shared across authorization contexts (e.g., a different access token requires a different cache).
contents: Vec<ReadResourceResultContentsItem>§result_type: StringIndicates the type of the result, which allows the client to determine how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".
ttl_ms: u64A hint from the server indicating how long (in milliseconds) the client MAY cache this response before re-fetching. Semantics are analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale, The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many milliseconds after receiving the response.
Implementations§
Source§impl ReadResourceResult
impl ReadResourceResult
Sourcepub fn new(
cache_scope: CacheScope,
contents: Vec<ReadResourceResultContentsItem>,
result_type: String,
ttl_ms: u64,
) -> ReadResourceResult
pub fn new( cache_scope: CacheScope, contents: Vec<ReadResourceResultContentsItem>, result_type: String, ttl_ms: u64, ) -> ReadResourceResult
Creates a value from its required fields; optional fields are None.
Trait Implementations§
Source§impl Clone for ReadResourceResult
impl Clone for ReadResourceResult
Source§fn clone(&self) -> ReadResourceResult
fn clone(&self) -> ReadResourceResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more