Skip to content

Refactor API / source layout? #17

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

Closed
epage opened this issue Mar 31, 2018 · 1 comment
Closed

Refactor API / source layout? #17

epage opened this issue Mar 31, 2018 · 1 comment
Labels
breaking-change enhancement Improve the expected

Comments

@epage
Copy link
Contributor

epage commented Mar 31, 2018

The layout in the docs / source feels strange with everything buried under the predicate module. The goal seems to be to allow imports like:

use predicates::{predicate, Predicate};

Proposal:

  • Move all predicate modules into the root with a pub use in lib.rs
  • Move Predicate and BoxedPredicate in dedicated private files in the root with a pub use in lib.rs.
  • Create a prelude module that contains
    • Predicate
    • predicate module which only re-exports the factory functions
      • Add a note to the factory functions about this
      • Add a note to the *Predicates about using the factories from predicate.

The standard import would now look like:

use predicates::prelude::*;

Benefits

  • Standard import is more consistent with regular stuff
  • Source and docs organization will be less nested
  • Docs will be a little more organized
  • The scope of the predicate module will be narrowed to just factories which imo makes the intent / starting point more clear.
@epage epage added the question Uncertainty is involved label Mar 31, 2018
@nastevens
Copy link
Collaborator

The source layout was an artifact of some early work to include "adapter" types, not unlike what is talked about in #21. The idea was that there would be two namespaces in the root, predicate and adapter. The adapters never materialized, but the layout remains.

The layout you describe seems much more usable, I give it a 👍 .

@epage epage added enhancement Improve the expected breaking-change and removed question Uncertainty is involved labels Apr 11, 2018
epage added a commit to epage/predicates-rs that referenced this issue Apr 11, 2018
Previously, the API was focused on convinience for importing in a
specific way.

This change splits out functionality from convinience.  The convinience
is now done via a prelude module.

Fixes assert-rs#17
epage added a commit to epage/predicates-rs that referenced this issue Apr 11, 2018
Previously, the API was focused on convenience for importing in a
specific way.

This change splits out functionality from convenience.  The convenience
is now done via a prelude module.

Fixes assert-rs#17
epage added a commit to epage/predicates-rs that referenced this issue Apr 11, 2018
Previously, the API was focused on convenience for importing in a
specific way.

This change splits out functionality from convenience.  The convenience
is now done via a prelude module.

Fixes assert-rs#17
@epage epage closed this as completed in #26 Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change enhancement Improve the expected
Projects
None yet
Development

No branches or pull requests

2 participants