[x] Moves all shared code from shared into src/lib.rs
[x] Imports shared library code into binaries using use altctrl::blah
From now on, consider anything belonging to lib.rs or anything that belongs to the module structure of the library (i.e. any module that can be found by following the pub mod path starting in lib.rs) as shared code. Any of the binaries can access the shared code just by using use altctrl e.g. with use altctrl::i2c::thing or use altctrl::gui::thing.
Future recommendations:
Rather than having a file called gui/gui_lib.rs, just put all of that shared code into gui/mod.rs. That way, suppose you have a function called foo in gui, you could access that by calling altctrl::gui::foo.
Currently, usr_ctrl is not part of the module structure (i.e. there is no mod usr_ctrl anywhere), therefore the code is not even being built by cargo, so it's quite possible that there's broken code in there. I'd recommend either adding that to the project structure or removing it.
All this does is move some files around.
src/bin
shared
intosrc/lib.rs
use altctrl::blah
From now on, consider anything belonging to
lib.rs
or anything that belongs to the module structure of the library (i.e. any module that can be found by following thepub mod
path starting inlib.rs
) as shared code. Any of the binaries can access the shared code just by usinguse altctrl
e.g. withuse altctrl::i2c::thing
oruse altctrl::gui::thing
.Future recommendations:
gui/gui_lib.rs
, just put all of that shared code intogui/mod.rs
. That way, suppose you have a function calledfoo
in gui, you could access that by callingaltctrl::gui::foo
.usr_ctrl
is not part of the module structure (i.e. there is nomod usr_ctrl
anywhere), therefore the code is not even being built by cargo, so it's quite possible that there's broken code in there. I'd recommend either adding that to the project structure or removing it.