-
Notifications
You must be signed in to change notification settings - Fork 164
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
refactor: make DataTypeRef
public and introduce a DataTypeTrait
trait
#390
Conversation
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
@tafia this is an example of what this would allow us to do on the fastexcel side: https://github.com/ToucanToco/fastexcel/pull/147/files#diff-b918afe42fb2f27a4f1d2295adf56664cdf9f5f089202d0ddf9a48245e15a47bR42 🙂 |
src/datatype.rs
Outdated
#[cfg(feature = "dates")] | ||
fn is_duration(&self) -> bool { | ||
matches!(*self, DataType::Duration(_)) | ||
} |
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.
Why is this (and similar methods) under the dates feature? This feature is needed only for converting excel date to chrono
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.
Because the as_{datetime,duration}
are under the dates
feature as well, so it was mainly for consistency.
Thanks for the PR. |
Maybe Apart from that, you wouldn't be opposed to having such a trait an making |
No I am definitely not opposed to having such trait and exposing the How about
An alternative? would be to use a |
|
Rename the following: * DataTypeTrait -> DataType * DataType -> Data * DataTypeRef -> DataRef Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Great. |
Awesome! Thanks! |
Thank you for the quick reviews! |
Hello there, I recently discovered
DataTypeRef
in the changelog, really nice addition!However, it is not publicly available through the API, so I figured I wanted to make it public. I then realised that it would be convenient to have a
DataType
trait, in order to allow for generics. I was thinking about something like this:Is this something you would be interested in ? If yes, we can probably find better naming for the trait and maybe a cleaner API ?
Cheers!