-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Documentation improvements #2996
Conversation
09e27b2
to
49385a8
Compare
A preview of the updated documentation can be found here: https://docs.diesel.rs/diesel_2.0_documentation_update/diesel/index.html |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
For anyone coming here from "This week in rust": I want to use this chance to reach out to potential users to get answers to the following questions:
Please leave a comment here or in this users.rust-lang.org thread. |
I'm assuming you mean the |
@mejrs Just to clarify that: This PR already implements that. Whats left is going over the generated documentation to check if the corresponding boxes appear in all locations. |
Ah, okay, that wasn't clear to me. I didn't see that this is a pull request rather than an issue and it very much read like a wishlist to me. |
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.
I've added some questions, remarks and suggestions here and there :)
FWIW, I would recommend using https://docs.rs/visibility rather than doing gymnastics with cfgs and cfg_attr's yourself. It's less likely to mess up and conveys intent better. But I have no idea whether it plays nice with doc_cfg
.
network-address = ["ipnetwork", "libc"] | ||
numeric = ["num-bigint", "bigdecimal", "num-traits", "num-integer"] | ||
postgres_backend = ["diesel_derives/postgres", "bitflags", "byteorder"] | ||
mysql_backend = ["diesel_derives/mysql", "byteorder"] | ||
i-implement-a-third-party-backend-and-opt-into-breaking-changes = [] |
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.
This seems somewhat dangerous. If I depend on such a backend, then I can also access those unstable features, and might use one without realizing.
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.
The probably best other solution here is to use a raw cfg flag, right?
The other option that I see is to split up diesel itself into multiple crates and reexport only the stable api via a diesel crate. Everything else is then only exposed via a 0.x internal crate. I assume that this solution will cause problems as well...
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.
Well, a raw cfg flag is how Tokio handles unstable features, but it does have the disadvantage that a crate cannot specify it, and that it must be specified by the person running cargo build
. (But that's also its advantage and why Tokio uses it over a feature.)
49385a8
to
24689fd
Compare
90a988c
to
72dae2a
Compare
@diesel-rs/reviewers This is ready for a review now. Especially I would like to hear opinions on the following points:
|
e16da42
to
6496252
Compare
e40aa72
to
e0dfeb2
Compare
@diesel-rs/reviewers I would like to move on with this PR and plan to merge this at 21.2 if there are no fundamental issues raised till then. |
* Introduce a feature to use the unstable rustdoc cfg_attr feature and classify all public items acoordinoly * Introduce a `i-implement-a-third-party-backend-and-opt-into-breaking-changes` feature flag that is used to hide most of the previously hidden API behind this feature flag. The idea is that we can use this feature to communicate some documentation about implementing third party backends while making clear that we may break those API's potentially * Change the any macro generated code to only use public API's or explicitly as `diesel::internal` exported API's * Add a lot documentation in different places * Make `diesel_derives` use the `with-deprecated`/`without-deprecated` feature flags as well * Simplify the signature of `Connection::load` even more
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
* Use a proc macro instead of doing manual `#[cfg(feature)]`/`#[cfg(not(feature)]` to make items public/non-public. * Introduce an explicit `backend` field for `AstPass` + pass in the corresponding backend for all usages. This will enable us to provide backend specific information to the query builder in the future. Examples are backend versions (like sqlite version x.y.z) or other general information about a backend (like that's mysql for a potential `AnyConnection` implementation). * Unignore some doc tests to verify that they are working * Wrap the buffer type for `RawBytesBindCollector` into an opaque type to allow us changing details later * Mark more parts of the API as unstable
53afa5d
to
b7541e4
Compare
30acff3
to
ad1ce71
Compare
4980def
to
7d07f64
Compare
@diesel-rs/reviewers I would like to merge this tomorrow if there are no objectives. |
Looks good to me :)
I feel like typically, new versions of backends may introduce new syntaxes, but do not modify behavior of old syntaxes. I'm not sure to what extent this scenario is likely enough that we want to have the additional complexity of passing a ref to the typically-zst around. So:
Based on the answers to these questions, we can:
On the other topics I'll definitely trust you on writing the doc and moving stuff around to make it more private ^^ |
❤️
Let me try to motivate the current change with some more details. I see two use cases here:
#[derive(MultiConnection)]
enum MultiConnection {
Pg(PgConnection),
Mysql(MysqlConnection),
// …
} where So now both motivating use cases are not directly relevant yet, but that's both something that I could imaging to happen while diesel 2.x is the current major diesel version. As that would be a breaking change we can do that either now, or later requiring another major version bump or later by finding another clever solution (for example by marking the corresponding functions as "private"/"i-implement-a-third-party-backend-and-opt-into-breaking-changes". To address some on for concerns:
As of this change we wrap the reference into
Caching already involves more than one layer of stuff. There is
|
Alright that looks good for me then :) |
Thanks for the feedback 👍. I will move on and merge this now. |
classify all public items acoordinoly
i-implement-a-third-party-backend-and-opt-into-breaking-changes
feature flag that is used to hide most of the previously hidden API
behind this feature flag. The idea is that we can use this feature to
communicate some documentation about implementing third party backends
while making clear that we may break those API's potentially
explicitly as
diesel::internal
exported API'sdiesel_derives
use thewith-deprecated
/without-deprecated
feature flags as well
Connection::load
even moreOpen points:
ignored
doc tests to see if they are building and if we could convert them to tests that are compiled