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 from an in-memory JSON value.
A frame whose type is any other unsigned integer returns
Ok(None), including message types this crate does not know. A value
without a type field, or whose type is not an unsigned integer,
is a malformed message rather than absence and is reported as an
error — the same strictness the transport’s record recognizer
applies, where both shapes mark a transport gap.
§Errors
Returns an error when the type field is missing or not an unsigned
integer, or 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.