Examples do not build with crate version from crates.io
Quba1 opened this issue · 2 comments
Quba1 commented
Simple Description on the Bug
Copying and pasting list_surfaces.rs
example into main.rs
of a new binary crate and adding grib = "0.3.0"
as a dependency into Cargo.toml
results in build errors.
Steps to Reproduce
- Create a new bin crate with
cargo new
- Copy paste
list_surfaces.rs
from examples intomain.rs
- Add
grib = "0.3.0"
as a dependency intoCargo.toml
- Build errors occur
Expected Behavior
No build errors. Example should just successfully compile and run.
Actual Behavior
Build errors:
error[E0277]: the trait bound `GribError: std::error::Error` is not satisfied
--> src/main.rs:31:85
|
31 | let grib2 = Grib2::<SeekableGrib2Reader<BufReader<File>>>::read_with_seekable(f)?;
| ^ the trait `std::error::Error` is not implemented for `GribError`
|
= note: required because of the requirements on the impl of `From<GribError>` for `Box<dyn std::error::Error>`
= note: required because of the requirements on the impl of `FromResidual<Result<Infallible, GribError>>` for `Result<(), Box<dyn std::error::Error>>`
note: required by `from_residual`
--> /home/quba/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/try_trait.rs:339:5
|
339 | fn from_residual(residual: R) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0599]: no method named `iter` found for struct `Grib2` in the current scope
--> src/main.rs:34:29
|
34 | for submessage in grib2.iter() {
| ^^^^ method not found in `Grib2<SeekableGrib2Reader<BufReader<File>>>`
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
Additional Context
The examples build correctly when the latest crate version from the repo is linked (`git clone --recurse-submodules -j8 https://github.com/noritada/grib-rs.git and link the crate locally). So the example is working just okay, and the issue is with the outdated version of the crate published on crates.io
Thus, the solution is simply updating the crate on crates.io (see issue #9).
noritada commented
Yes, I should have mentioned the required crate versions for the code.