#Cannot find value `book` in this scope, not found in this scope Error
13 messages · Page 1 of 1 (latest)
How would that work if there is no book in the _ branch?
return the an option that may contain the book value
i think this will work (forgive my current mobile state)
playground
A browser interface to the Rust compiler to experiment with the language
let book: Option<Xls<_>> = match path.extension() {
Some("xlsx") | Some("xls") => Some(open_workbook(path).expect("Cannot open file")),
_ => {
println!("whatever");
None
}
};
cannot match that on Some("literal") unfortunately
Why not?
it's an osstr, not str
i thank you all but i found a solution thanks to friend, he told me to do like that and it worked, i will be happy if you share your opinion on that so i can learn more.
the input file can be xls or xlsx so i needed a way to accept both, calamine created a wrapper that help when the file type is not known
yeah just not doing that works too
we found this solution because compiler give us error