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

Use cargo features to allow fine-grain control of the library. #354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hydra
Copy link

@hydra hydra commented Sep 21, 2021

This is a for-discussion PR that proposes a way of dealing the problem of this crate serving a few too many concerns for the needs of some users as discussed in #239

The idea is that chunks of the code-base are marked as optional so that users can choose which features they need.

I started with code that used dependencies but this could be expanded to cover more features.

Contrast and compare:

$ cargo tree -e all --no-default-features
cortex-m v0.7.3
├── bitfield feature "default"
│   └── bitfield v0.13.2
└── volatile-register feature "default"
    └── volatile-register v0.2.1
        └── vcell feature "default"
            └── vcell v0.1.3
deps)
$ cargo tree -e all
cortex-m v0.7.3
├── bare-metal feature "const-fn"
│   └── bare-metal v0.2.5
│       [build-dependencies]
│       └── rustc_version feature "default"
│           └── rustc_version v0.2.3
│               └── semver feature "default"
│                   └── semver v0.9.0
│                       └── semver-parser feature "default"
│                           └── semver-parser v0.7.0
├── bare-metal feature "default"
│   └── bare-metal v0.2.5 (*)
├── bitfield feature "default"
│   └── bitfield v0.13.2
├── embedded-hal feature "default"
│   └── embedded-hal v0.2.6
│       ├── void v1.0.2
│       └── nb feature "default"
│           └── nb v0.1.3
│               └── nb feature "default"
│                   └── nb v1.0.0
└── volatile-register feature "default"
    └── volatile-register v0.2.1
        └── vcell feature "default"
            └── vcell v0.1.3
$ cargo tree -e all --no-default-features --features="delay"
cortex-m v0.7.3
├── bitfield feature "default"
│   └── bitfield v0.13.2
├── embedded-hal feature "default"
│   └── embedded-hal v0.2.6
│       ├── void v1.0.2
│       └── nb feature "default"
│           └── nb v0.1.3
│               └── nb feature "default"
│                   └── nb v1.0.0
└── volatile-register feature "default"
    └── volatile-register v0.2.1
        └── vcell feature "default"
            └── vcell v0.1.3
$ cargo tree -e all --no-default-features --features="interrupt"
cortex-m v0.7.3
├── bare-metal feature "const-fn"
│   └── bare-metal v0.2.5
│       [build-dependencies]
│       └── rustc_version feature "default"
│           └── rustc_version v0.2.3
│               └── semver feature "default"
│                   └── semver v0.9.0
│                       └── semver-parser feature "default"
│                           └── semver-parser v0.7.0
├── bare-metal feature "default"
│   └── bare-metal v0.2.5 (*)
├── bitfield feature "default"
│   └── bitfield v0.13.2
└── volatile-register feature "default"
    └── volatile-register v0.2.1
        └── vcell feature "default"
            └── vcell v0.1.3

@hydra hydra requested a review from a team as a code owner September 21, 2021 12:45
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.

None yet

1 participant