pub trait BarDatum {
fn get_category(&self) -> String;
fn get_value(&self) -> f32;
fn get_key(&self) -> String;
}
pub trait PointDatum<T, U> {
fn get_x(&self) -> T;
fn get_y(&self) -> U;
fn get_key(&self) -> String;
}
impl BarDatum for (f32, &str) {
fn get_category(&self) -> String {
String::from(self.1)
}
fn get_value(&self) -> f32 {
self.0
}
fn get_key(&self) -> String {
String::new()
}
}
impl BarDatum for (String, f32, String) {
fn get_category(&self) -> String {
String::from(&self.0)
}
fn get_value(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::from(&self.2)
}
}
impl BarDatum for (&str, f32, &str) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::from(self.2)
}
}
impl BarDatum for (&str, isize, &str) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::from(self.2)
}
}
impl BarDatum for (String, f32) {
fn get_category(&self) -> String {
String::from(&self.0)
}
fn get_value(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::new()
}
}
impl BarDatum for (&str, f32, String) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::from(&self.2)
}
}
impl BarDatum for (&str, f32) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::new()
}
}
impl BarDatum for (&str, i32, String) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::from(&self.2)
}
}
impl BarDatum for (&str, i32) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::new()
}
}
impl BarDatum for (&str, i32, &str) {
fn get_category(&self) -> String {
String::from(self.0)
}
fn get_value(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::from(self.2)
}
}
impl PointDatum<f32, f32> for (f32, f32) {
fn get_x(&self) -> f32 {
self.0
}
fn get_y(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::new()
}
}
impl PointDatum<f32, f32> for (isize, isize) {
fn get_x(&self) -> f32 {
self.0 as f32
}
fn get_y(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::new()
}
}
impl PointDatum<f32, f32> for (isize, isize, &str) {
fn get_x(&self) -> f32 {
self.0 as f32
}
fn get_y(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::from(self.2)
}
}
impl PointDatum<f32, f32> for (f32, f32, &str) {
fn get_x(&self) -> f32 {
self.0
}
fn get_y(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::from(self.2)
}
}
impl PointDatum<f32, f32> for (isize, isize, String) {
fn get_x(&self) -> f32 {
self.0 as f32
}
fn get_y(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
self.2.clone()
}
}
impl PointDatum<f32, f32> for (f32, f32, String) {
fn get_x(&self) -> f32 {
self.0
}
fn get_y(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
self.2.clone()
}
}
impl PointDatum<String, f32> for (String, f32) {
fn get_x(&self) -> String {
self.0.clone()
}
fn get_y(&self) -> f32 {
self.1
}
fn get_key(&self) -> String {
String::new()
}
}
impl PointDatum<String, f32> for (String, isize) {
fn get_x(&self) -> String {
self.0.clone()
}
fn get_y(&self) -> f32 {
self.1 as f32
}
fn get_key(&self) -> String {
String::new()
}
}