crypto_botters_api/
lib.rs

1//! This crate is meant to be used by the `crypto-botters` crate.
2//! This crate only exists to prevent cyclic dependencies.
3
4use std::fmt::Debug;
5
6/// A `trait` that represents an option which can be set when creating handlers
7pub trait HandlerOption: Default {
8    type Options: HandlerOptions<OptionItem=Self>;
9}
10
11/// Set of [HandlerOption] s
12pub trait HandlerOptions: Default + Clone + Debug {
13    /// The element of this set
14    type OptionItem: HandlerOption<Options=Self>;
15
16    fn update(&mut self, option: Self::OptionItem);
17}
18
19/// A `trait` that shows the implementing type is able to create [generic_api_client::http::RequestHandler]s
20pub trait HttpOption<'a, R>: HandlerOption {
21    type RequestHandler;
22
23    fn request_handler(options: Self::Options) -> Self::RequestHandler;
24}
25
26/// A `trait` that shows the implementing type is able to create [generic_api_client::websocket::WebSocketHandler]s
27pub trait WebSocketOption<H>: HandlerOption {
28    type WebSocketHandler;
29
30    fn websocket_handler(handler: H, options: Self::Options) -> Self::WebSocketHandler;
31}