is_sys_path()
is in lib.rs
I'm trying to use it in utils.rs
I see Using Rust modules and libraries
but what about the reverse, using Rust library functions in a Rust pub mod
?
From my understanding, this should just kind of work via crate::lib_fn()
or maybe my_lib::lib_fn()
but I'm getting:
cannot find function 'is_sys_path' in module 'crate'
or
failed to resolve: use of undeclared crate or module 'my_lib'
cargo.toml
[package]
name = "my_lib"
version = "0.1.1"
authors = ["mike"]
publish = false
edition = "2018"
[dependencies]
...
[lib]
name = "my_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
File Tree
- src
- utils.rs
- metrics.rs
- lib.rs
- main.rs
- fv_structopt.rs
- fv_structs.rs
- cargo.toml
utils.rs
pub mod utils {
use crate::metrics::metrics as metric;
fn get_dir_deep_check(deep: bool, dir_entry_path: PathBuf) -> bool {
file_vacuum::is_sys_path(); // error
let is_not_sys = !crate::is_sys_path(&dir_entry_path); // error
...
}
lib.rs
pub mod metrics;
pub mod utils;
use utils::utils as util;
use metrics::metrics as metric;
pub fn is_sys_path(path: PathBuf) {
...
}
main.rs
mod fv_structopt;
mod fv_structs;
...