I am fairly new to Rust, started looking into it around 2 months ago. After following the book for some time, I am now building a simple shell to hopefully expose myself to more problems that are more likely to occur when building something.
The shell currently has barebone functionality (not even!), but before adding features, I wanted to ensure that the design is flexible and modular. I think I am at a good point to ask for feedback.
If you spot any pitfalls, unidomatic usage of Rust, or anything in general really, please let me know.
Your structs should derive more traits (Debug et al.).
handle_parsed_input() is pretty long. Consider refactoring it into smaller methods.
help_msg in show_help() could be a global const.
process_input() returns a tuple of an optional input and state. It may be better to use the type system to prevent inconsistencies between the input state variant and value option. Hence InputState could be rewritten as:
Many thanks for taking the time and your feedback!
Agree on all, really.
Kind of lacking the experience on what are the must-haves for any/most structs to derive. I seems Debug and Clone should pretty much be always derived for any struct.
Hard agree on the refactor of the handle_parsed_input() perhaps even its name.. Already in the todo to write some helpers for it. I'll take a look soon.
Intersting to use a const for help -and for other similarly static-nature stuff to come
Regarding the InputState, I really like the idea of ensuring the valid response type so definitely will update it as you suggest.