pub trait Handler:
Send
+ Sync
+ 'static {
// Required methods
fn handle_events(&self, event: TradingViewDataEvent, message: &[Value]);
fn handle_quote_data(&self, message: &[Value]);
fn handle_series_data(
&self,
event: TradingViewDataEvent,
messages: &[Value],
);
fn notify_error(&self, error: Error, message: &[Value]);
}Expand description
Core event handler trait — object-safe, supports Arc<dyn Handler>.
Unlike v1, this trait does not require Clone or a new()
constructor. Use HandlerFactory for construction and Arc<dyn Handler> when shared ownership is needed.
Required Methods§
Sourcefn handle_events(&self, event: TradingViewDataEvent, message: &[Value])
fn handle_events(&self, event: TradingViewDataEvent, message: &[Value])
Called when a TradingView data event is received.
Sourcefn handle_quote_data(&self, message: &[Value])
fn handle_quote_data(&self, message: &[Value])
Called when quote data is received (e.g., price updates).
Sourcefn handle_series_data(&self, event: TradingViewDataEvent, messages: &[Value])
fn handle_series_data(&self, event: TradingViewDataEvent, messages: &[Value])
Called when series/historical data is received.
Sourcefn notify_error(&self, error: Error, message: &[Value])
fn notify_error(&self, error: Error, message: &[Value])
Called when an error occurs in the WebSocket or command pipeline.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".