chars_rev iterator does not exist anymore (std::str::StrSlice) ?
2014-05-31 22:17 GMT+02:00 Vladimir Matveev <[email protected]>: > Hi, Christophe, > > You shouldn't be using `~str` at all, you should use `String`. Also, > `box ""` is not a replacement for `~""`, they have different types. > The proper replacement is `String::new()` or `"".to_string()". > > Your code in modern Rust will look like this: > > /// Contains a list of properties. A property is a key-value pair. > pub struct Properties { > props: HashMap<String, String> > } > > impl Map<String, String> for Properties { > /// Get a property value giving its name. Return None if property > does not exist. > fn find<'a>(&'a self, key: &String) -> Option<&'a String> { > self.props.find(key) > } > > /// Return true if a property value exists for the specified key > fn contains_key(&self, key: &String) -> bool { > self.props.contains_key(key) > } > } > > > > 2014-05-31 22:21 GMT+04:00 Christophe Pedretti < > [email protected]>: > > Hi all, > > > > i have updated my rust compiler, i have several compilations errors on my > > project > > > > StrBuf does not exist any more, no problem, i now use String > > ~"" is obsolete, no problem, i use box "" > > The last isssue is " failed to find an implementation of trait > > core::cmp::TotalEq for ~str" > > util\properties.rs:12 self.props.find(key) > > ^~~~~~~~~~~~~~~~~~~~ > > > > My code is very simple and was compiling before > > > > ///Contains a list of properties. A property is a key-value pair. > > pub struct Properties { > > props : HashMap<~str, ~str> > > } > > > > impl Map<~str, ~str> for Properties { > > ///Get a property value giving its name. Return None if property does not > > exist. > > fn find<'a>(&'a self, key : &~str) -> Option<&'a ~str> { > > self.props.find(key) > > } > > ///Return true if a property value exists for the specified key > > fn contains_key(&self, key: &~str) -> bool { > > self.props.contains_key(key) > > } > > } > > > > what i am doing wrong ? > > > > Thanks > > > > > > _______________________________________________ > > Rust-dev mailing list > > [email protected] > > https://mail.mozilla.org/listinfo/rust-dev > > >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
