pub struct FeedHandler { /* private fields */ }Expand description
Deserializes incoming WebSocket messages into venue-specific types.
The handler owns the WebSocketClient exclusively within the lock-free I/O boundary, eliminating RwLock contention on the hot path.
Implementations§
Source§impl FeedHandler
impl FeedHandler
Sourcepub fn new(
cmd_rx: UnboundedReceiver<HandlerCommand>,
out_tx: UnboundedSender<DydxWsOutputMessage>,
raw_rx: UnboundedReceiver<Message>,
client: WebSocketClient,
signal: Arc<AtomicBool>,
subscriptions: SubscriptionState,
) -> Self
pub fn new( cmd_rx: UnboundedReceiver<HandlerCommand>, out_tx: UnboundedSender<DydxWsOutputMessage>, raw_rx: UnboundedReceiver<Message>, client: WebSocketClient, signal: Arc<AtomicBool>, subscriptions: SubscriptionState, ) -> Self
Creates a new FeedHandler.
Sourcepub async fn run(&mut self)
pub async fn run(&mut self)
Main processing loop for the handler.
§Panics
This method will not panic. The expect call on iter.next() is safe
because we explicitly check that msgs is not empty before calling it.
Sourcepub async fn handle_message(
&mut self,
msg: DydxWsMessage,
) -> DydxWsResult<Vec<DydxWsOutputMessage>>
pub async fn handle_message( &mut self, msg: DydxWsMessage, ) -> DydxWsResult<Vec<DydxWsOutputMessage>>
Handles control messages from the fallback parsing path.
Channel data is handled directly via handle_feed_message().
§Errors
Returns an error if the message cannot be processed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FeedHandler
impl !RefUnwindSafe for FeedHandler
impl Send for FeedHandler
impl Sync for FeedHandler
impl Unpin for FeedHandler
impl UnsafeUnpin for FeedHandler
impl !UnwindSafe for FeedHandler
Blanket Implementations§
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<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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].