Skip to content

Commit

Permalink
Merge pull request #6 from negi-grass/restructure
Browse files Browse the repository at this point in the history
Restructure
  • Loading branch information
negi-grass authored Jan 3, 2023
2 parents 3cae8bf + 9367dc5 commit ab8caba
Show file tree
Hide file tree
Showing 20 changed files with 631 additions and 295 deletions.
56 changes: 27 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[workspace]
members = ["generic-api-client", "crypto-botters-binance", "crypto-botters-bitflyer"]
default-members = ["generic-api-client", "crypto-botters-binance", "crypto-botters-bitflyer"]

[package]
name = "crypto-botters"
Expand All @@ -27,6 +25,7 @@ bitflyer = ["dep:crypto-botters-bitflyer"]

[dependencies]
generic-api-client = { version = "0.1", path = "generic-api-client" }
crypto-botters-api = { version = "0.1", path = "crypto-botters-api" }
crypto-botters-binance = { version = "0.2", path = "crypto-botters-binance", optional = true }
crypto-botters-bitflyer = { version = "0.2", path = "crypto-botters-bitflyer", optional = true }

Expand Down
6 changes: 6 additions & 0 deletions crypto-botters-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "crypto-botters-api"
version = "0.1.0"
edition = "2021"

[dependencies]
31 changes: 31 additions & 0 deletions crypto-botters-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//! This crate is meant to be used by the `crypto-botters` crate.
//! This crate only exists to prevent cyclic dependencies.
use std::fmt::Debug;

/// A `trait` that represents an option which can be set when creating handlers
pub trait HandlerOption: Default {
type Options: HandlerOptions<OptionItem=Self>;
}

/// Set of [HandlerOption] s
pub trait HandlerOptions: Default + Clone + Debug {
/// The element of this set
type OptionItem: HandlerOption<Options=Self>;

fn update(&mut self, option: Self::OptionItem);
}

/// A `trait` that shows the implementing type is able to create [generic_api_client::http::RequestHandler]s
pub trait HttpOption<'a, R>: HandlerOption {
type RequestHandler;

fn request_handler(options: Self::Options) -> Self::RequestHandler;
}

/// A `trait` that shows the implementing type is able to create [generic_api_client::websocket::WebSockethandler]s
pub trait WebSocketOption<H>: HandlerOption {
type WebSocketHandler;

fn websocket_handler(handler: H, options: Self::Options) -> Self::WebSocketHandler;
}
1 change: 1 addition & 0 deletions crypto-botters-binance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ categories = ["api-bindings", "asynchronous", "cryptography::cryptocurrencies",

[dependencies]
generic-api-client = { version = "0.1", path = "../generic-api-client" }
crypto-botters-api = { version = "0.1", path = "../crypto-botters-api" }
serde = { version = "1.0.151", features = ["derive"] }
serde_urlencoded = "0.7.1"
serde_json = "1.0.90"
Expand Down
Loading

0 comments on commit ab8caba

Please sign in to comment.