You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Got here based on your article on Medium. The approach is explained in a simple and straight to the point manner.
What I actually like to do is to declare the modules in lib.rs, considering main.rs (or any other [[bin]] for this matter) to be responsible of just using it, and not also declare it.
This means:
instead of having both the declaration and usage of a module in main.rs:
mod blog;use blog::Post;
we could have the module(s) declared in lib.rs:
pubmod blog;
with blog.rs being in the same location (src) as lib.rs
and `main would just use them:
use{package-name}::blog::Post;
What do you think? Is it just a subjective perspective?
The text was updated successfully, but these errors were encountered:
Hi Siva,
Got here based on your article on Medium. The approach is explained in a simple and straight to the point manner.
What I actually like to do is to declare the modules in
lib.rs
, consideringmain.rs
(or any other[[bin]]
for this matter) to be responsible of just using it, and not also declare it.This means:
main.rs
:lib.rs
:blog.rs
being in the same location (src
) aslib.rs
and `main would just use them:
What do you think? Is it just a subjective perspective?
The text was updated successfully, but these errors were encountered: