Menu

1 / 2

My Tiny Rust Utils, Part 5: mod.rs

DEV Community·icsboyx·6 months ago
#KxdGWGBQ
Reading 0:00
15s threshold

This last part is about the least impressive file in the crate:

pub mod helpers ; pub mod macros ; pub mod save_load ; pub mod web ;

Enter fullscreen mode

Exit fullscreen mode

That is src/utils/mod.rs .

It is just four lines.

And maybe that is why it feels like the right place to end the series.

Why a boring file still matters

I like this file because it does not pretend to be smarter than it is.

It just says:

these are the utility modules

they live together

this is the shape of the toolbox

After the previous parts, that shape is easier to read:

macros.rs helps me see what the program is doing

helpers.rs removes a bit of error and JSON friction

save_load.rs gives me one place for config-like persistence

web.rs keeps HTTP glue from leaking everywhere

None of those files is huge.

None of them is a framework.

That is very intentional.

I think I work better when the code is allowed to stay small and honest for as long as possible.

How the crate feels to me

This utils crate is not something…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.