-
Notifications
You must be signed in to change notification settings - Fork 543
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
Rename LocalResult
to TzResolution
, add alias
#1501
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1501 +/- ##
=======================================
Coverage 91.80% 91.80%
=======================================
Files 40 40
Lines 18337 18338 +1
=======================================
+ Hits 16835 16836 +1
Misses 1502 1502 ☔ View full report in Codecov by Sentry. |
|
I don't love the name?
(I feel like it's probably slightly better than |
Hmm. The result of finding the offset of a local datetime within a timezone, which needs a decision on how to deal with times that fall in a transition. What more names can we think up for it?
|
|
Those also don't seem to be it. The result is not current, a projection, and there may be no expectation? Resolve, resolution or result seem closer to me. Maybe something that has 'map' or 'disambiguation' (https://peps.python.org/pep-0495/) in the name? I don't like something as long as disambiguation though. |
|
|
After looking at the dictionary Seems a reasonable type to return from |
Seems like a decent option... |
The least bad 😆. With this name I do think it is best to combine it with making the type only return Have you already formed an opinion on that? |
Why/how is that related to the naming? In principle I like the idea of bringing the new name to 0.4.x as an alias to potentially get some feedback.
I have not, and this description doesn't help me form an opinion. Are there commits that flesh out this idea? |
It is a bit strange if
I put effort in the description in the linked comment. But I'll try to make some commits after the rename. |
7ac5b3a
to
a19202a
Compare
src/datetime/rustc_serialize.rs
Outdated
@@ -13,16 +13,16 @@ impl<Tz: TimeZone> Encodable for DateTime<Tz> { | |||
} | |||
} | |||
|
|||
// lik? function to convert a LocalResult into a serde-ish Result | |||
fn from<T, D>(me: LocalResult<T>, d: &mut D) -> Result<T, D::Error> | |||
// lik? function to convert a MappedLocalTime into a serde-ish Result |
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.
"lik?"?
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 have no clue. Remove it?
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.
Yup.
src/offset/mod.rs
Outdated
/// which the local time is _missing_, or does not exist. | ||
/// | ||
/// Chrono does not return a default choice or invalid data during time zone transitions, but has | ||
/// the `MappedLocalTime` to help deal with the result correctly. |
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.
"has the MappedLocalTime
to" -> "has the MappedLocalTime
type to".
a19202a
to
6969d9e
Compare
Something weird happened with my branches, I'll figure it out |
6969d9e
to
4189fb0
Compare
The name
LocalResult
is unfortunate because in Rust types called*Result
are used as return values for error cases.However in our case it is not an error (at least not usually) but a choice of how to deal with time zone transitions due to for example DST.
We can do the rename on the 0.5.x branch or on main. If we think
TzResolution
is a better name that helps in understanding the use we may as well start using it on 0.4.x. With a type alias with the old name that is easy.Doing the rename on main also has the advantage of keeping the branches a bit more similar. But if 0.5.x is a better target I'll rebase of course.
The first commit is a simple find-replace-rustfmt.
The second commit extends the documentation.