sing/src/lib.rs

56 lines
1.4 KiB
Rust
Raw Normal View History

use core::fmt::Debug;
use serde::{Serialize, Deserialize};
use serde_wrapper::ImplItemMethodWrapper;
mod serde_wrapper;
#[derive(Debug, Clone, Serialize, Deserialize)]
struct TraitProfile{
//functions: HashMap<String, FunctionProfile>,
functions: Vec<ImplItemMethodWrapper>,
}
#[derive(Debug, Clone)]
enum DeduplicatedFunctionProfile {
Single(String, ImplItemMethodWrapper),
Multiple(Vec<String>, ImplItemMethodWrapper),
}
/*impl<T> Evaluator<T> {
fn deduplicate_functions(&self) -> Self<T> {
let mut self = self.clone();
let mut functions: HashMap<String, DeduplicatedFunctionProfile>;
for (t_name, t_profile) in self.traits {
for (fun_name, fun_profile) in t_profile.functions {
if !functions.contains_key(fun_name) {
self.functions.insert(fun_name, DeduplicatedFunctionProfile::Single(t_name, fun_profile))
} else {
let other = self.functions.remove(fun_name).unwrap();
let traits: Vec<String>;
match other {
DeduplicatedFunctionProfile::Single(t, _) => traits = vec!(t),
DeduplicatedFunctionProfile::Multiple(ts, _) => traits = ts,
}
self.functions.insert(fun_name, DeduplicatedFunctionProfile::Multiple(traits, fun_profile))
}
}
}
}
}
*/
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}