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
impl<T> CloneAny for 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more