Can't use crate::Log after add lib.rs

Is the Log reserved word like lib? Because it resolving until add lib.rs file in project /src

image

unresolved import `crate::Log`
no `Log` in the root

UPD
seems not reserved, it happen only when connect in lib.rs some mod from main.rs crate

// lib.rs
pub mod connection; // same in main.rs

UPD2 / solution
looks like I can't just use main.rs features in lib.rs - instead of that, I should define those members in lib.rs and use them as part of library API.

When you have both a main.rs and lib.rs they are the root of two distinct module trees. "Unfortunately" since they are on the same filesystem, two modules can share the same source file.

If both of them declare a mod foo; the file foo.rs will get compiled twice.

1 Like