Hello forum !
I'm writing a library and I have two files:
src/lib.rs
src/types.rs
in types.rs I've added all the struct definitions, while in lib.rs I0ve added all the functions that I want to made available.
Now I'm facing this problem: in both types.rs and lib.rs I'm usinge the zerocopy crate. So i've added:
- "use zerocopy::AsBytes;" in lib.rs
- "use zerocopy::{AsBytes, FromBytes, FromZeroes};" in types.rs
after running:
cargo add zerocopy
Now when I run:
$ rustc --crate-type=lib src/lib.rs
the comiler complains that:
error[E0432]: unresolved import
zerocopy
--> src/lib.rs:1:5
|
1 | use zerocopy::AsBytes;
| ^^^^^^^^ maybe a missing cratezerocopy
?
|
= help: consider addingextern crate zerocopy
to use thezerocopy
crate
How can I fix that ?
thanks !