This file contains hidden or 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
| use test::Bencher; | |
| #[derive(Debug)] | |
| pub struct Rate { | |
| pub id: u8, | |
| pub from: String, | |
| pub to: String, | |
| pub exchange: String, | |
| pub rate: f64, | |
| pub vol: f64, |
This file contains hidden or 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
| fn escape_str<W: fmt::Write>(mut f: W, mut s: &str, replacements: &[(u8, &str)]) -> fmt::Result { | |
| while !s.is_empty() { | |
| let (idx, replacement) = s | |
| .as_bytes() | |
| .iter() | |
| .enumerate() | |
| .find_map(|(i, c)| { | |
| replacements | |
| .iter() | |
| .find(|(r, _)| c == r) |
OlderNewer