You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I liked your video and wanted to check the Rust impl out, and I felt that it could be made better. Here's what I came up with, this uses thiserror for a proper error type, but a Box<dyn Error> should work fine as well.
I also notice that methods that already return R<T, B> doesn't catch IO errors, like
fnload_rsv(file_path:&str) -> Result<Vec<Vec<Option<String>>>,Box<dynError>>{let bytes = fs::read(file_path).expect("Could not load RSV file");returndecode_rsv(bytes);}
Could just be
fnload_rsv(file_path:&str) -> Result<Vec<Vec<Option<String>>>,Box<dynError>>{Ok(decode_rsv(fs::read(file_path)?)?)// Second ? needed assuming decode_rsv is using a concrete error type}
The text was updated successfully, but these errors were encountered:
Hi, I liked your video and wanted to check the Rust impl out, and I felt that it could be made better. Here's what I came up with, this uses
thiserror
for a proper error type, but aBox<dyn Error>
should work fine as well.I also notice that methods that already return R<T, B> doesn't catch IO errors, like
Could just be
The text was updated successfully, but these errors were encountered: