SHARE
TWEET

Untitled

a guest Mar 20th, 2017 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::collections::BTreeSet;
  2. extern crate time;
  3.  
  4. #[derive(Debug)]
  5. enum Message {
  6.     New,
  7.     Change,
  8.     Delete,
  9.     DeleteThru,
  10.     DeleteFrom
  11. }
  12.  
  13.  
  14. #[derive(Debug)]
  15. struct PriceUpdate {
  16.     time: time::Tm,
  17.     action: Message,
  18.     price: f64,
  19.     quantity: i32,
  20.     order_count: i32,
  21.     level: i8
  22. }
  23.  
  24. #[derive(Debug)]
  25. struct Bid(PriceUpdate);
  26.  
  27. #[derive(Debug)]
  28. struct Ask(PriceUpdate);
  29.  
  30. struct Book {
  31.     orders: BTreeSet<PriceUpdate>
  32. }
  33.  
  34.  
  35.  
  36. fn main() {
  37.    let t = time::now_utc();
  38.    let pu = Bid {
  39.        time: time::now_utc(),
  40.        action: Message::New,
  41.        price: 1.0,
  42.        quantity: 100,
  43.        order_count: 100,
  44.        level: 1
  45.     };
  46.  
  47.    
  48.    println!("{:?}", pu);
  49. }
RAW Paste Data
Top