Reputation:
Goal: Get this to import successfully so I can start using the functions.
Rust Code:
pub use crate::pqcrypto_dilithium::*;
fn main() {
println!("Hello, world!");
}
Cargo.toml:
[package]
name = "project"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
pqcrypto-dilithium = "0.4.5"
Error:
error[E0432]: unresolved import `crate::pqcrypto_dilithium`
--> main.rs:1:16
|
1 | pub use crate::pqcrypto_dilithium::*;
| ^^^^^^^^^^^^^^^^^^ maybe a missing crate `pqcrypto_dilithium`?
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
Upvotes: 0
Views: 535
Reputation:
The proper code to use is the following:
pub use pqcrypto_dilithium::*;
fn main() {
println!("Hello, world!");
}
Upvotes: 1
Reputation: 2875
I think you should not start with crate::
.
crate::
means starting looking from this working crate's root.
If you have a module named pqcrypto_dilithium
in the project root, then it will work. Just like:
// main.rs/lib.rs
mod pqcrypto_dilithium { ... }
pub use crate::pqcrypto_dilithium::*;
---
// main.rs/lib.rs
mod wrap {
mod pqcrypto_dilithium { ... }
}
// This is not going to work
pub use crate::pqcrypto_dilithium::*;
// Works
pub use crate::wrap::pqcrypto_dilithium::*;
Finally, in your case: pqcrypto_dilithium
is a dep, an external crate. So you can not do that.
But you can simply do:
pub use pqcrypto_dilithium::*;
Upvotes: 0