Revert PR 201 "Expose internals to lib" #207
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 9314804.
I'd rather not make this API public; it forces semver on us and we would have to bump the minor
version more often. For example, we would have to bump the minor version whenever we change the API
of
generate::{interrupt,..,register}::render
, which happens to be a pretty big API surface as itincludes structs from the
svd
and thesyn
crates so if we (minor version) bump any of thosedependencies then we have to bump the minor version of
svd2rust
as well.Also the more often we bump minor versions the more work we give to device crate authors: now when
they re-generate their device crates they have to check if the minor version actually broke the
generated API or if it just was due to change in the API of
svd2rust
, the library.If we want to expose some API to turn SVD files into Rust code in build scripts (which I think it's
a bad idea (*)) we should expose a single function that takes a string in (the SVD file) and
returns a string (the Rust code).
(*) It forces all your users (both direct and indirect) to (re-)build
svd2rust
(whichtakes non trivial amount of time) for every one of their Cargo projects that depends on your
crate. And for no gain whatsoever because the output of
svd2rust
depends only on the input SVD andnot on the build environment (unlike say running
bindgen
on C headers installed in/usr
) so it'sjust a waste of CPU cycles. It's better to cache the output of
svd2rust
in the device crate, IMO.r? @Emilgardis
cc @dfrankland