-
Notifications
You must be signed in to change notification settings - Fork 2
export structs for direct access #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update module and struct visibility across several files to make various resume-related types and modules publicly accessible from the crate root. Public re-exports are added in Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/resume/basics.rs (1)
5-6
: Do we really need these sub-modules publicly visible?
lib.rs
only re-exports theLocation
andProfile
structs, not the wholelocation
/profile
modules.
Exposing the modules themselves leaks internal layout (files, helpers, private items) into the public API surface and makes future refactors a breaking change.A lighter alternative keeps the modules private and re-exports just the types:
-mod location; -mod profile; +mod location; +mod profile; + +// bubble the structs up without exposing the modules +pub use location::Location; +pub use profile::Profile;This still satisfies the re-export lines in
lib.rs
(resume::basics::Location
, etc.) while preserving encapsulation.src/resume.rs (1)
4-15
: Large public surface – considerpub use
instead ofpub mod
All sub-modules are now
pub
, which lets downstream crates doyour_crate::resume::award::Award
, bypassing the curated re-exports inlib.rs
.
If the intent is only to expose the structs (not the modules) you can reduce churn and future breaking changes with:-mod award; // repeat for every sub-module +mod award; +pub use award::Award; // repeat for every public struct
lib.rs
will still compile because it referencesresume::Award
, notresume::award::Award
, and external users won’t see the internal folders.Feel free to keep the current form if full module access is a deliberate design choice.
src/lib.rs (1)
4-19
: Re-export list is verbose and hard to maintainWhenever a new resume section is added you’ll need to update this list in two places (
resume.rs
and here).
Two ideas that keep the API unchanged while reducing boilerplate:
- Re-export everything defined in
resume
:-// Re-export all resume structures for direct access -pub use resume::Resume; -pub use resume::award::Award; -... -pub use resume::work::Work; +pub use resume::{ + Resume, + award::Award, + basics::{Basics, location::Location, profile::Profile}, + certificate::Certificate, + education::Education, + interest::Interest, + language::Language, + project::Project, + publication::Publication, + reference::Reference, + skill::Skill, + volunteer::Volunteer, + work::Work, +};
- Create a
pub mod prelude
withpub use resume::*;
and instruct users touse your_crate::prelude::*;
.Either option trims duplication and centralises exports.
No functional issue – this is purely a maintainability concern.
Summary by CodeRabbit
New Features
Refactor