Skip to content
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

feat: add Sys trait for swapping out system #109

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dsherret
Copy link

@dsherret dsherret commented Jan 2, 2025

Creates a Sys trait and puts any system related functionality behind it.

This has several benefits:

  1. Enables in-memory testing of this crate in the future (for now, I've only implemented a default RealSys implementation).
  2. Allows consumers of this crate to not depend on env_home, rustix, and winsafe if they already have code or other dependencies for doing this.
    • Allows changing the behaviour of tilde expansion (for example, previously this crate relied on using winapi to get the home directory on Windows, but now it uses env_home, which only looks at the environment variables)
  3. Opens the possibility to using this crate in wasm32-unknown-unknown as someone can provide their own which::Sys implementation.

@Xaeroxe
Copy link
Collaborator

Xaeroxe commented Jan 2, 2025

I like this but can we adjust the presentation a bit? I'd consider this a feature for advanced users. So we should move the README example into the generated rustdocs. Additionally let's not flatten the sys module in our exports, just make the module public.

@Xaeroxe
Copy link
Collaborator

Xaeroxe commented Jan 2, 2025

Also if you haven't already you should use your new trait in a proof of concept implementation for your own use case. It'd be a shame if we needed to revise the trait after this was already published.

@dsherret
Copy link
Author

dsherret commented Jan 2, 2025

Also if you haven't already you should use your new trait in a proof of concept implementation for your own use case. It'd be a shame if we needed to revise the trait after this was already published.

Yes, that would be good. I'll look into doing that later. Going to convert this PR to draft until I find the time.

@dsherret dsherret marked this pull request as draft January 2, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants