I've made my first Rust project and wanted some feedback to learn about my mistakes and improve my Rust skills. I've used this project as a learning ground for Rust so I am sure there are a ton of stuff that can be improved, nonetheless I don't have anybody besides me to get feedback so I am coming to you for this.
Here's my project: https://gitlab.com/fastotp1/fastotp
It tries to make use of Robert C. Martin Clean Architecture to achieve a clean separation between logic and non-logic components and having as a consequence, hopefully, of allowing multiple GUI front-ends to be implemented.
Additionally I've also collected a bunch of questions that have arisen:
- Is the use of Arc + AsyncRwLock sensible for the shared types or could it be replaced with something simpler?
- Where could owned values be replaced with borrowing, impl Trait, generics, etc.?
- Is it ok that every struct uses String instead of &str?
- Is the use of lifetimes around the code base adequate?
- Which performance optimizations could be done (e.g. redundant clone()'s, boxing, lack of use of generics, etc.)
- Are the implementations of the streams correct? How can they be improved?
- Which changes in code organization or similar can be made to improve compile times?
- Which traits could be implemented that could improve code quality and readability?
- Could something be done to reduce repetition of the presenters (e.g. macros)?
- Where could declarative macros help reducing boilerplate in fastotp_iced_gui crate?
- Is code organization well-reasoned (e.g. modules, use of directory with mod.rs + single .rs file)?
- Which derive clauses should be used for each struct?
- What could be improved in the architecture?
- Is the use of AES-GCM-SIV ok, or better something like XChaCha20-Poly1305?
- Are the used imports the better ones?
- What could be behind a cargo feature?
- Is the architecture adequate to have interchangeable UI frontends (e.g. GUI, CLI, web, etc)?
- Which documentation practices could be included?
- Where could the use of const generics, const arrays, or in general const operations improve the code?
- Where could the try '?' operator be used to improve code reading?
If you have experience with Gitlab, or you have feedback outside the Rust code itself, that is also welcome.
Thanks for looking by