Reputation: 176
I'm building out a crate and for use across several applications I'm working on. At the moment, I have a handful of functions that serve as 'helpers' for the rest of the crate which I would like to expose across my crate but not to the applications. Is there a way to do this? A middle ground between public and private?
example:
// lib.rs
pub mod mod_a;
pub mod mod_b;
// mod_a.rs, mod_b.rs
use helpers::bar;
pub fn foo() {
bar()
}
...
// helpers.rs
pub fn bar(x: i64) {
return(x+1)
}
I would like to expose the function bar
to mod_a
and mod_b
, without exporting it from my crate
Upvotes: 1
Views: 111