1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Traits to be used throughout the crate


use std::fmt::{Debug, Display};
use bytevec::{ByteDecodable, ByteEncodable};

use prelude::*;
mod series_groupby;
mod dataframe_groupby;
pub use self::series_groupby::*;
pub use self::dataframe_groupby::*;

/* 
    Traits used throughout crate
*/

/// Trait dictates the supported primitives for use in [`Series`] structs.
pub trait BlackJackData: ByteDecodable + ByteEncodable + Debug + ToString + Clone + Send + Display {

    /// Return the current [`DType`] for this type. 
    fn dtype(&self) -> DType;
}
impl BlackJackData for f64 {
    fn dtype(&self) -> DType { DType::F64 }
}
impl BlackJackData for i64 {
    fn dtype(&self) -> DType { DType::I64 }
}
impl BlackJackData for f32 {
    fn dtype(&self) -> DType { DType::F32 }
}
impl BlackJackData for i32 {
    fn dtype(&self) -> DType { DType::I32 }
}
impl BlackJackData for String {
    fn dtype(&self) -> DType { DType::STRING }
}

/* 
    Series traits
*/