I want to organize some functions into multiple files since they're big enough to warrant that but from outside of that directory I want them all to appear to be exported from same parent module.
I have the files:
/main.rs
/example/mod.rs
/example/a.rs
/example/b.rs
From within main.rs
, I want to be able to do:
use example::{a, b};
Both a.rs
and b.rs
contain a single function:
/example/a.rs
pub fn a() { }
/example/b.rs
pub fn b() { }
I can't figure out how to export them from /example/mod.rs
such that it appears to be all in the example
module.
I can do this:
/example/mod.rs
pub mod a;
pub mod b;
But then my use
later looks like:
/main.rs
use example::a::a;
use example::b::b;
// How do I do this?
// use example::{a, b};
EDIT: The solution is to have /example/mod.rs
look like this:
pub use a::a;
pub use b::b;
mod a;
mod b;