logo
  • Search
  • Reddit Posts 🔥
  • Archive
  • GitHub

When do you put logic in mod.rs?

35 points Tester4360 2022-09-25 23:25:08
View on Reddit ↗

I’m coming from a JavaScript background where index.js is typically only used to re-export files.

Looking at Rust crates, there’s typically logic in the mod.rs files (https://github.com/tokio-rs/axum/blob/main/axum/src/handler/mod.rs).

When do you include logic in the mod.rs file instead of a separate file?

© 2025 Query.rs, built by Folyd with ❤️❤️, see about page to learn more · meiguo.app · aiberm.com