-
Notifications
You must be signed in to change notification settings - Fork 2
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
This crate can be made no-std and no-alloc #9
Comments
Is there a known maximum possible size in bytes for ISO datetime for a given precisions? If so, you could expose a constant function that I could use for the input array size. |
Hi, I'm glad to see this crate get some use! This was my first crate and it has some foibles as you've found out. I have been using it internally for other projects but since it is getting some interest I will do a comb through and clean things up further. I agree with making the crate no-alloc and implementing a custom error type. IIRC you're correct about string related functions being unnecessarily gated behind the
ISO date-time strings can have varying precision, but if this precision was specified with a const generic or similar then this should be possible without too much change to the API. Would this fit your use case? |
Thanks!
This would be needed if the ISO function would be infallible, but I was thinking that it should simply check that an input slice had the needed length otherwise it would return an error. |
Hi @AaronKutch, I've opened #10 as the |
It's perfect thank you. |
Hello, this crate is nearly perfect for my usecase, except that it appears to be unnecessarily dependent on
std
. From a quick scan of the crate,std
is only actually needed forSystemTime
. I would recommend making your own error enum withthiserror
so that you can get rid ofanyhow
, and then usingalloc::String
for any strings. Furthermore, it should be possible to make the crate usefully no-alloc by gating anything with strings behind an "alloc" feature, and adding a variation ofas_iso_datetime
that takes a mutable slice of bytes and usesstr::from_utf8_mut
to return a&mut str
. This would make the crate usable anywhere. There aren't any no-alloc datetime crates as far as I am aware.The text was updated successfully, but these errors were encountered: