Skip to main content

barter_integration/protocol/
mod.rs

1use crate::error::SocketError;
2use futures::Stream;
3
4/// Contains useful `WebSocket` type aliases and a default `WebSocket` implementation of a
5/// [`StreamParser`].
6pub mod websocket;
7
8/// Contains HTTP client capable of executing signed & unsigned requests, as well as an associated
9/// execution oriented HTTP request.
10pub mod http;
11
12/// `StreamParser`s are capable of parsing the input messages from a given stream protocol
13/// (eg/ WebSocket, Financial Information eXchange (FIX), etc.) and deserialising into an `Output`.
14pub trait StreamParser<Output> {
15    type Stream: Stream;
16    type Message;
17    type Error;
18
19    fn parse(input: Result<Self::Message, Self::Error>) -> Option<Result<Output, SocketError>>;
20}