user7954302
user7954302

Reputation: 41

What to do if rust module function is private

I wanted to use qoi in my rust project and tried this module, https://github.com/ChevyRay/qoi_rs The problem is that, when I write this:

use qoi::Pixel;

The error :

error[E0432]: unresolved import `qoi::Pixel`
 --> src/create_images.rs:4:5
  |
4 | use qoi::Pixel;
  |     ^^^^^-----
  |     |    |
  |     |    help: a similar name exists in the module: `pixel`
  |     no `Pixel` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `Thing_in_rust` due to previous error

so I tried pixel :

use qoi::pixel;

And this error message pops up

error[E0603]: module `pixel` is private
  --> src/create_images.rs:4:10
   |
4  | use qoi::pixel;
   |          ^^^^^ private module
   |

I am new to rust, but looking at the github code https://github.com/ChevyRay/qoi_rs/blob/main/src/pixel.rs gave me the impression that it is public.
cargo.toml :

[dependencies]
qoi = "0.4.0"

Upvotes: 0

Views: 1549

Answers (1)

Masklinn
Masklinn

Reputation: 42592

The crate you've linked to doesn't seem to be published on crates.io, although there's a multitude of qoi crates over there.

So your options are either:

  • use one of the crates which is published on crates.io
  • use a direct git dependency rather than a cargo one
  • a variant of the second one is to vendor the crate using a path dependency in case you need to update it

Upvotes: 1

Related Questions