pub struct BrowserFrame {
pub id: u64,
pub status: Option<u16>,
pub headers: Option<BTreeMap<String, String>>,
pub body: Option<String>,
pub encoding: Option<String>,
pub error: Option<String>,
pub stream: Option<bool>,
pub chunk: Option<String>,
pub seq: Option<u64>,
pub done: Option<bool>,
}Expand description
Browser → server frame: a superset of BrowserReply plus the streaming
fields (stream/chunk/seq/done).
The WebSocket reader deserialises every inbound frame into this struct, then
interprets it as a buffered reply or a StreamItem depending on which
waiter is registered for its id. Modelled as a flat struct of Options so
one serde deserialise accepts every shape.
Fields§
§id: u64Correlation id echoed from the Command.
status: Option<u16>HTTP status code (buffered success, or a stream’s head frame).
headers: Option<BTreeMap<String, String>>Response headers (buffered success, or a stream’s head frame).
body: Option<String>Buffered response body.
encoding: Option<String>Buffered body transfer encoding (Some("base64") for binary bodies).
error: Option<String>Error message when the browser fetch() failed.
stream: Option<bool>Some(true) on the first frame of a streamed response (head: status +
headers, no body yet).
chunk: Option<String>Base64-encoded body chunk of a streamed response.
seq: Option<u64>Monotonic chunk sequence number within a stream.
done: Option<bool>Some(true) on the terminating frame of a streamed response.
Implementations§
Source§impl BrowserFrame
impl BrowserFrame
Sourcepub fn into_reply(self) -> BrowserReply
pub fn into_reply(self) -> BrowserReply
Interprets this frame as a buffered reply (the back-compat path taken when the registered waiter is a one-shot buffered request).
Sourcepub fn stream_item(self) -> StreamItem
pub fn stream_item(self) -> StreamItem
Interprets this frame as a StreamItem (taken when the registered
waiter is a stream). An error wins; then done; then a chunk;
otherwise the frame is the stream’s head.
Trait Implementations§
Source§impl Clone for BrowserFrame
impl Clone for BrowserFrame
Source§fn clone(&self) -> BrowserFrame
fn clone(&self) -> BrowserFrame
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 BrowserFrame
impl Debug for BrowserFrame
Source§impl<'de> Deserialize<'de> for BrowserFrame
impl<'de> Deserialize<'de> for BrowserFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BrowserFrame
Source§impl PartialEq for BrowserFrame
impl PartialEq for BrowserFrame
Source§fn eq(&self, other: &BrowserFrame) -> bool
fn eq(&self, other: &BrowserFrame) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BrowserFrame
impl Serialize for BrowserFrame
impl StructuralPartialEq for BrowserFrame
Auto Trait Implementations§
impl Freeze for BrowserFrame
impl RefUnwindSafe for BrowserFrame
impl Send for BrowserFrame
impl Sync for BrowserFrame
impl Unpin for BrowserFrame
impl UnsafeUnpin for BrowserFrame
impl UnwindSafe for BrowserFrame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.