-
Notifications
You must be signed in to change notification settings - Fork 6
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
How should we handle provider APIs and their visibility? #165
Comments
…APIs (#169) This PR lays out the general concept laid out in #165. Primarily, this PR splits the core Temporal functionality that can be used by engines into the `builtins::core` module and then builds out wrappers for nearly all of the core builtins (Currently only `PlainYearMonth` and `PlainMonthDay` have not had wrappers implemented) that can be used directly from Rust in the `builtins::native` module. Ideally, this provides a better experience for using the library natively from Rust (while also giving us a cleaner API to write tests with), but still allows `with_provider` API to be used for engines and/or anyone else who wants to implement their own `TimeZoneProvider`.
Yeah, I have a feeling that might be the best way to go about handling this. That being said, the other solution is to remove "full" from being a default feature and have the wrapper types be opt-in. It prevents the problems with the FFI and stops any of the rust-analyzer workspace issues that happen when |
I'd not use |
Agreed, that's why the initial change was |
The big reasons for the breaks here is that the previous implementation was greedy and tried to get away with using the To fix it, the current implementation wrappers can be added for the But adding the wrappers doesn't address the "opt-in" or "opt-out" behavior if the wrappers or kept. Is there any preference for one approach over the other? |
I'm still unclear on the purpose of this split; why it is implemented the way it is. If it's extra APIs, it should be implemented on the same type, right? It's a violation of feature unification to hide APIs when a feature is enabled. Users of this crate may end up with breakages when found in a larger deptree.
This seems fine to me? |
+1 for @Manishearth's comment. If having wrappers is just overcomplicating FFI and feature resolution, we should just return to separate |
I'd be open to that idea. That would solve the issue with multiple feature flagged impl blocks all in one file. Is there any preference as to how to handle API visibility. Do we forego attempting to separate |
I think it's fine to leave them exposed. The |
Submitted #181 to hopefully address the points mentioned in the above discussion. |
This PR fixes #169 and is related to #165, and a couple of other issues / discussions that popped up after the restructure merge. This mainly restructures the codebase to remove the wrapping types and flag the non "with_provider" methods behind a non-default "compiled_data" flag. Let me know what you think!
We need to deal with the provider API vs. non-provider API in a way that is ergonomic and
sane to deal with rather than keeping them in the same files (Mea culpa).
Currently, if we expose a non
with_provider
API, thewith_provider
method is still available. So if we makeZonedDateTime::to_ixdtf_string
available thenZonedDateTime::to_ixdtf_string_with_provider
will be available as well.My initial thought is to separate the the two APIs into separate modules and then expose
them via feature flags.
General proposal overview
The general directory structure would be one of the two below.
NOTE: any bikeshedding on names would be fine by me. I like the
core
terminology for themain implementation, but I'm not entirely convinced
std
is a good name. (Sort of mimickingRust's
core
vs.std
separation).OR
The main idea would be to have all non-feature flagged APIs live in
core
. Meanwhile, forall the general usage APIs (currently flagged "experimental") would be under
std
.The general usage APIs would then just be either a reexport of the
core
impl or aNewType of the core implementations if it has any provider APIs.
Other Options:
The text was updated successfully, but these errors were encountered: