Skip to main content

StreamParser

Trait StreamParser 

Source
pub trait StreamParser {
    type Output;

    // Required method
    fn parse(message: &Value, market: Option<&Market>) -> Result<Self::Output>;
}
Expand description

Trait for parsing WebSocket stream messages into typed data.

Implementations of this trait handle the conversion of raw JSON messages from Binance WebSocket streams into strongly-typed Rust structures.

Required Associated Types§

Source

type Output

The output type produced by this parser

Required Methods§

Source

fn parse(message: &Value, market: Option<&Market>) -> Result<Self::Output>

Parse a WebSocket message into the output type.

§Arguments
  • message - The raw JSON message from the WebSocket
  • market - Optional market information for symbol resolution
§Returns

The parsed data or an error if parsing fails

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§