Created
October 28, 2017 21:59
-
-
Save stiv-yakovenko/d982f2757a4b9da684102bc8b9cebbae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate rand; | |
use std::collections::HashMap; | |
use std::cell::RefCell; | |
use std::collections::*; | |
pub struct Aliases { | |
pub idx_to_name:HashMap< i16,String>, | |
pub name_to_idx:HashMap< String,i16> | |
} | |
pub struct Polynome { | |
pub poly: BTreeMap<i16, f64>, | |
pub aliases: RefCell<Aliases>, | |
} | |
impl Aliases { | |
pub fn new()->Aliases{ | |
Aliases{idx_to_name:HashMap::new(),name_to_idx:HashMap::new()} | |
} | |
} | |
impl Polynome { | |
pub fn new() -> Polynome { | |
Polynome { | |
poly: BTreeMap::new(), | |
aliases: RefCell::new(Aliases::new()), | |
} | |
} | |
pub fn clone(&self) -> Polynome { | |
Polynome { | |
poly: self.poly.clone(), | |
aliases: self.aliases, | |
} | |
} | |
} | |
fn main() { | |
println!("hi"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment