Browse Source

reorg: move iso stuff to its own mod, add crypto mod

tags/v0.2.0
Jonathan Strong 4 years ago
parent
commit
3cec4b8b40
4 changed files with 1148 additions and 52 deletions
  1. +7
    -2
      Cargo.toml
  2. +1089
    -0
      src/crypto.rs
  3. +46
    -0
      src/iso.rs
  4. +6
    -50
      src/lib.rs

+ 7
- 2
Cargo.toml View File

@@ -1,6 +1,6 @@
[package]
name = "markets"
version = "0.1.0"
version = "0.2.0"
authors = ["Jonathan Strong <jstrong@tioscapital.com>"]
edition = "2018"

@@ -10,5 +10,10 @@ edition = "2018"
serde = { version = "1", features = ["derive"] }
chrono = { version = "0.4", features = ["serde"] }
chrono-tz = "0.4"
uuid = { version = "0.7.0", features = ["serde", "v4", "slog"] }
#uuid = { version = "0.7.0", features = ["serde", "v4", "slog"] }
hashbrown = { version = "0.6.3", default_features = false, features = ["serde", "ahash"] }
#decimal = { git = "https://git.mmcxi.com/mm/decimal", branch = "v2.3.x" }
#decimal-macros = { git = "https://git.mmcxi.com/mm/decimal-macros", rev = "v0.2.1", optional = true }

[features]
unstable = []

+ 1089
- 0
src/crypto.rs
File diff suppressed because it is too large
View File


+ 46
- 0
src/iso.rs View File

@@ -0,0 +1,46 @@
use serde::{Serialize, Deserialize};
use chrono_tz::Tz;
use chrono_tz::US::{Eastern, Central, Pacific};
use chrono_tz::Etc::GMTPlus5;

use Market::*;

#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
#[repr(u8)]
pub enum Market {
Pjm = 1,
Miso = 2,
Caiso = 3,
Ercot = 4,
Spp = 5,
Nyiso = 6,
Iso = 7,
}

impl Market {
pub fn time_zone(&self) -> Tz {
match self {
Pjm => Eastern,
Miso => GMTPlus5,
Caiso => Pacific,
Ercot => Central,
Spp => Central,
Nyiso => Eastern,
Iso => Eastern,
}
}

pub fn as_str(&self) -> &'static str {
match self {
Pjm => "pjm",
Miso => "miso",
Caiso => "caiso",
Ercot => "ercot",
Spp => "spp",
Nyiso => "nyiso",
Iso => "isone",
}
}
}



+ 6
- 50
src/lib.rs View File

@@ -1,52 +1,8 @@
use serde::{Serialize, Deserialize};
use chrono_tz::Tz;
use chrono_tz::US::{Eastern, Central, Pacific};
use chrono_tz::Etc::GMTPlus5;
#![cfg_attr(all(test, feature = "unstable"), feature(test))]

use Market::*;
#[cfg(all(test, feature = "unstable"))]
extern crate test;

#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
#[repr(u8)]
pub enum Market {
Pjm = 1,
Miso = 2,
Caiso = 3,
Ercot = 4,
Spp = 5,
Nyiso = 6,
Iso = 7,
}

impl Market {
pub fn time_zone(&self) -> Tz {
match self {
Pjm => Eastern,
Miso => GMTPlus5,
Caiso => Pacific,
Ercot => Central,
Spp => Central,
Nyiso => Eastern,
Iso => Eastern,
}
}

pub fn as_str(&self) -> &'static str {
match self {
Pjm => "pjm",
Miso => "miso",
Caiso => "caiso",
Ercot => "ercot",
Spp => "spp",
Nyiso => "nyiso",
Iso => "isone",
}
}
}

#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
pub mod iso;
//#[macro_use]
pub mod crypto;

Loading…
Cancel
Save