pub struct SignalRInvocation { /* private fields */ }Expand description
A decoded SignalR invocation frame.
Implementations§
Source§impl SignalRInvocation
impl SignalRInvocation
Sourcepub fn from_value(value: Value) -> Result<Option<Self>, RealtimeError>
pub fn from_value(value: Value) -> Result<Option<Self>, RealtimeError>
Decodes a type-1 SignalR invocation.
Non-invocation frames return Ok(None).
§Errors
Returns an error when a type-1 frame has a missing or malformed target, contract identifier, or payload argument list.
Sourcepub fn from_json(json: &str) -> Result<Option<Self>, RealtimeError>
pub fn from_json(json: &str) -> Result<Option<Self>, RealtimeError>
Decodes a type-1 SignalR invocation directly from its JSON record.
Unlike Self::from_value, this path retains the original JSON token
for the event entity so exact provider decimals do not first pass
through a floating-point serde_json::Value.
§Errors
Returns an error when the record is malformed or has an invalid target, contract identifier, or payload argument list.
Sourcepub fn contract_id(&self) -> Option<&ContractId>
pub fn contract_id(&self) -> Option<&ContractId>
Returns the market contract argument, when supplied.
Sourcepub fn entity(&self) -> &Value
pub fn entity(&self) -> &Value
Returns the event entity, unwrapping a provider { "data": ... }
envelope when present.
Sourcepub fn decode<T>(&self) -> Result<T, RealtimeError>where
T: DeserializeOwned,
pub fn decode<T>(&self) -> Result<T, RealtimeError>where
T: DeserializeOwned,
Deserializes the event entity into a provider model.
§Errors
Returns an error when the provider payload does not match T.
Sourcepub fn decode_batch<T>(&self) -> Vec<Result<T, RealtimeError>>where
T: DeserializeOwned,
pub fn decode_batch<T>(&self) -> Vec<Result<T, RealtimeError>>where
T: DeserializeOwned,
Deserializes a single entity or every non-null entry in an entity array.
Each array entry is decoded independently so one malformed provider
record does not hide the other valid records in the same invocation.
ProjectX’s null padding entries are omitted.
Trait Implementations§
Source§impl Clone for SignalRInvocation
impl Clone for SignalRInvocation
Source§fn clone(&self) -> SignalRInvocation
fn clone(&self) -> SignalRInvocation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more