Skip to content

Instantly share code, notes, and snippets.

@m10e
Last active December 18, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m10e/5840213 to your computer and use it in GitHub Desktop.
Save m10e/5840213 to your computer and use it in GitHub Desktop.
rustc disapproves. once_entry.rs:40:16: 40:61 error: mismatched types: expected `~str` but found `&str` (str storage differs: expected ~ but found &) once_entry.rs:40 adj_str = adj_str.slice_chars(1, adj_str.char_len()-1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pub fn parse(munny: &Munny, day: &time::Tm, tokens: &mut ~[~str]) {
if tokens.len() < 1 {
fail!("Too few arguments!")
}
// Pop adjustment string.
let mut set = false;
let mut adj_str = vec::pop(tokens);
// See if there's a '=' preceding it. If so, note that and slice it.
if adj_str.starts_with("=") {
set = true;
adj_str = adj_str.slice_chars(1, adj_str.char_len()-1);
}
// Parse adjustment amount.
match f64::from_str(adj_str) {
Some(adj) => { fail!("FIXME"); }
None => { fail!("Once adjustment not a proper f64!"); }
}
// Create Once instance and add to entries set.
fail!(~"FIXME");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment