How to use functions in files under the same directory?

Say for a library crate, under src/ I have 3 files: lib.rs, a.rs, b.rs.

I write a function f() in b.rs. How can I call it in file a.rs?

If I write mod b; in a.rs, the compiler will find it under directory src/a/. But this is not what I want. For example, I may have cyclic dependency.

OK. I fix this.

In file b.rs, make f() pub.

Then in file a.rs, add this line: use b::*; (I actually want to import all functions like f()).