Refactor different APIs into separate modules #24

Open
opened 2026-10-14 23:31:28 +00:00 by tentype · 0 comments
Member

Objective

backend/src/lib.rs contains the bulk of the bus sign backend's functionality, with all the different APIs in the same file. It would be best to refactor this file into multiple smaller ones so that it is more maintainable.

Ideally, lib.rs should only contain docs, module declarations, re-exports (pub use), and shared top-level types.

Suggested Approach

This is a backend task.

Perhaps extract the OpenWeather API into its own weather.rs module, the PRT API into a prt.rs module, etc. Refactor at your own discretion!

Chapter 7 of the Rust Book may be helpful here. Pay close attention to how the mod, pub, use, and as keywords are used in Rust projects.

## Objective `backend/src/lib.rs` contains the bulk of the bus sign backend's functionality, with all the different APIs in the same file. It would be best to refactor this file into multiple smaller ones so that it is more maintainable. Ideally, `lib.rs` should only contain docs, module declarations, re-exports (`pub use`), and shared top-level types. ## Suggested Approach This is a **backend** task. Perhaps extract the OpenWeather API into its own `weather.rs` module, the PRT API into a `prt.rs` module, etc. Refactor at your own discretion! [Chapter 7 of the Rust Book](https://doc.rust-lang.org/book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html) may be helpful here. Pay close attention to how the `mod`, `pub`, `use`, and `as` keywords are used in Rust projects.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/bus-sign#24
No description provided.