We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In section 12.4, copy and paste of Listing 12-16 includes code from Listing 12-15. Current result of copy paste:
use std::error::Error; use std::fs; pub struct Config { pub query: String, pub filename: String, } impl Config { pub fn new(args: &[String]) -> Result<Config, &str> { if args.len() < 3 { return Err("not enough arguments"); } let query = args[1].clone(); let filename = args[2].clone(); Ok(Config { query, filename }) } } pub fn run(config: Config) -> Result<(), Box<dyn Error>> { let contents = fs::read_to_string(config.filename)?; Ok(()) } pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { vec![] } #[cfg(test)] mod tests { use super::*; #[test] fn one_result() { let query = "duct"; let contents = "\ Rust: safe, fast, productive. Pick three."; assert_eq!(vec!["safe, fast, productive."], search(query, contents)); } }
Pasted result for Listing 12-16 should be:
pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { vec![] }
The text was updated successfully, but these errors were encountered:
This is how mdbook works with hidden code; please see rust-lang/mdBook#712 for discussion of whether this is how it should work or not. Thanks!
Sorry, something went wrong.
No branches or pull requests
In section 12.4, copy and paste of Listing 12-16 includes code from Listing 12-15.
Current result of copy paste:
Pasted result for Listing 12-16 should be:
The text was updated successfully, but these errors were encountered: