Skip to content

Commit

Permalink
add question exsample for #2
Browse files Browse the repository at this point in the history
  • Loading branch information
zuowenjian committed Mar 31, 2018
1 parent 51cd32d commit ca98115
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion triat/Cargo.toml → exchange/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "trait"
name = "exchange"
version = "0.1.0"
authors = ["zuowenjian <[email protected]>"]

Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion triat/src/model.rs → exchange/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use std::result::Result ;

#[derive(Debug)]
pub struct Order
{}
{
pub price : f64,
pub vol : f64,
}
#[derive(Debug)]
pub enum Error
{
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions triat/src/plat_impl.rs → exchange/src/plat_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ pub trait Plat{}

impl <T> Fetch for T where T: Plat
{
fn local_fetch_data(&self, path: &String) -> String
fn local_fetch_data(&self, _path: &String) -> String
{
String::from("")
String::from("data from local")

}
fn remot_fetch_data(&self, path: &String) -> String
fn remot_fetch_data(&self, _path: &String) -> String
{
String::from("")
String::from("data from remote")

}

Expand All @@ -46,7 +46,9 @@ impl <T> Conv for T
{
fn to_orders(&self,str : &String) -> OrderVecR
{
Err(Error::Unimpl)
debug!("to_orders from {}", str) ;
Ok(vec![Order{ price : 0.10 , vol : 0.10}])
//Err(Error::Unimpl)

}

Expand Down
1 change: 1 addition & 0 deletions qustion
Submodule qustion added at e2d450

0 comments on commit ca98115

Please sign in to comment.