pub enum DeriveWsFrame {
Response {
id: u64,
result: Option<Value>,
error: Option<JsonRpcError>,
},
Subscription(WsSubscriptionPayload),
Unknown(Value),
}Expand description
Inbound frame discriminated by whether it carries an id (response to a
client request) or a method (server-initiated notification).
Variants§
Response
JSON-RPC response correlated with an outbound request id.
Fields
§
error: Option<JsonRpcError>Error payload when the venue rejected the request.
Subscription(WsSubscriptionPayload)
Server-initiated subscription update.
Unknown(Value)
Frame we could decode as JSON but did not recognize; surfaced so logs can flag unknown server-initiated messages without dropping silently.
Implementations§
Source§impl DeriveWsFrame
impl DeriveWsFrame
Sourcepub fn parse(text: &str) -> Result<Self>
pub fn parse(text: &str) -> Result<Self>
Parses a raw text frame into the discriminated DeriveWsFrame.
Returns the original JSON error when the bytes are not valid JSON; callers log and drop the frame in that case.
§Errors
Returns serde_json::Error when text is not valid JSON.
Trait Implementations§
Source§impl Clone for DeriveWsFrame
impl Clone for DeriveWsFrame
Source§fn clone(&self) -> DeriveWsFrame
fn clone(&self) -> DeriveWsFrame
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeriveWsFrame
impl RefUnwindSafe for DeriveWsFrame
impl Send for DeriveWsFrame
impl Sync for DeriveWsFrame
impl Unpin for DeriveWsFrame
impl UnsafeUnpin for DeriveWsFrame
impl UnwindSafe for DeriveWsFrame
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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