Closed darleybarreto closed 1 month ago
Would you be interested in merging a contribution to make tz-rs full no_std?
Yes this could be a good addition to the library.
The following methods are missing when the std
feature is disabled :
std::fs
and std::io
for parsing.std::time
.What would be the best approach here? Having traits for everything that requires std and then implementing on relibc? And for those who can use std, nothing changes, just need to add boilerplate to current code.
A trait is a good idea, like in the following code:
pub trait StdImpl {
fn new() -> Self;
fn now() -> i64;
// ...
// define all needed methods
}
pub struct Std;
impl StdImpl for Std {
fn new() -> Self {
Self
}
// impl using std
}
pub struct GenericTimeZone<T: StdImpl> {
// ...
std: T
}
pub type TimeZone = GenericTimeZone<Std>;
Adding a new trait method afterwards will be a breaking change, so we should be careful when selecting needed methods.
I see, thanks for the great feedback. I will give this a try.
Hey, I'm not really a Rust expert, would you be able to expand more on your first comment? The pain points here are mostly the types directly used inside, so I'm having a hard time figuring this out properly.
This is more complex than it seems, I will try to do a first implementation myself.
Implemented in tz-rs v0.7.0
.
Wow, thank you soo much!!
Hi there,
Would you be interested in merging a contribution to make
tz-rs
full no_std?I am asking this because I think this crate can help relibc a lot. For both Redox and Linux, we basically have all the necessary building blocks to use
tz-rs
, including logging etc.What would be the best approach here? Having traits for everything that requires
std
and then implementing onrelibc
? And for those who can use std, nothing changes, just need to add boilerplate to current code.Kind regards,
Darley