Skip to content

Commit

Permalink
fix: spell miss (Raw and Row)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirumirumi committed May 8, 2023
1 parent 36aa9a7 commit 937af9b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum Exchange {
}

impl Exchange {
pub fn retrieve(&mut self, args: &mut ParsedArgs) -> Result<Vec<Raw>, Error> {
pub fn retrieve(&mut self, args: &mut ParsedArgs) -> Result<Vec<Row>, Error> {
match self {
Exchange::Binance(binance) => binance.retrieve(args),
Exchange::Bitbank(bitbank) => bitbank.retrieve(args),
Expand All @@ -68,7 +68,7 @@ impl Exchange {
pub trait Retrieve: Debug {
fn prepare(&mut self, args: &ParsedArgs) -> Result<(), Error>;

fn retrieve(&mut self, args: &mut ParsedArgs) -> Result<Vec<Raw>, Error> {
fn retrieve(&mut self, args: &mut ParsedArgs) -> Result<Vec<Row>, Error> {
let mut result: Vec<Kline> = Vec::new();
let mut should_continue = true;
let client = reqwest::blocking::Client::new();
Expand Down
10 changes: 5 additions & 5 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum FormatType {
}

impl FormatType {
pub fn format(&self, data: &[Raw]) -> String {
pub fn format(&self, data: &[Row]) -> String {
let mut result = match self {
FormatType::Raw => self.raw(data),
FormatType::Csv => self.csv(data),
Expand All @@ -34,7 +34,7 @@ impl FormatType {
result
}

fn raw(&self, data: &[Raw]) -> String {
fn raw(&self, data: &[Row]) -> String {
let mut result = String::new();
let delimiter = format!("{}", style(", ").dim());

Expand All @@ -53,7 +53,7 @@ impl FormatType {
result
}

fn csv(&self, data: &[Raw]) -> String {
fn csv(&self, data: &[Row]) -> String {
let mut result = String::new();
let delimiter = ",";

Expand All @@ -70,7 +70,7 @@ impl FormatType {
result
}

fn tsv(&self, data: &[Raw]) -> String {
fn tsv(&self, data: &[Row]) -> String {
let mut result = String::new();
let delimiter = "\t";

Expand All @@ -87,7 +87,7 @@ impl FormatType {
result
}

fn json(&self, data: &[Raw]) -> String {
fn json(&self, data: &[Row]) -> String {
/*
In JSON, duplicate keys are not allowed, so if there is data with duplicate Pick values,
it cannot be directly converted to JSON. However,checking input commands across both
Expand Down
4 changes: 2 additions & 2 deletions src/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub enum Order {

impl Order {
/// Use to print finally result
pub fn sort(mut data: Vec<Raw>, order: &Self) -> Vec<Raw> {
let compare = |a: &Raw, b: &Raw| {
pub fn sort(mut data: Vec<Row>, order: &Self) -> Vec<Row> {
let compare = |a: &Row, b: &Row| {
let unixtime_a = a.iter().flat_map(|map| map.get(&Pick::T)).next().unwrap();
let unixtime_b = b.iter().flat_map(|map| map.get(&Pick::T)).next().unwrap();
unixtime_a
Expand Down
6 changes: 3 additions & 3 deletions src/pick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ pub enum Pick {
}

impl Pick {
pub fn up(data: Vec<Kline>, pick: &[Self]) -> Vec<Raw> {
pub fn up(data: Vec<Kline>, pick: &[Self]) -> Vec<Row> {
use Pick::*;

let mut result: Vec<Raw> = Vec::new();
let mut result: Vec<Row> = Vec::new();

for (i, d) in data.iter().enumerate() {
result.push(Vec::new());
Expand Down Expand Up @@ -237,7 +237,7 @@ mod tests {
.cloned()
.collect::<HashMap<_, _>>()],
])]
fn test_up_with_parameters(#[case] input: Vec<Pick>, #[case] expected: Vec<Raw>) {
fn test_up_with_parameters(#[case] input: Vec<Pick>, #[case] expected: Vec<Row>) {
let data = vec![
Kline {
unixtime_msec: 1682325360000,
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ use std::collections::HashMap;

use crate::{exchange::KlineNumber, pick::Pick};

pub type Raw = Vec<HashMap<Pick, KlineNumber>>;
pub type Row = Vec<HashMap<Pick, KlineNumber>>;

0 comments on commit 937af9b

Please sign in to comment.