Comments (9)
Hi, I want to hide DateTime
as an implementation detail and only use the standard SystemTime
. Avoiding the allocated string would be good. I could either provide a function like this:
pub fn format_http_date(f: &mut fmt::Formatter, d: SystemTime) -> fmt::Result {
DateTime::from(d).fmt(f)
}
It avoids the intermediate string but it can only be called if you already have a formatter. The alternative would be a type pub struct HttpDate (SystemTime}
and implement FromStr
and Display
for it. Do you know if the smaller size of DateTime
actually makes a difference?
from httpdate.
Well, the tokio's structures are generally quite large. And sure, 16 bytes vs 8 bytes of timestamp does not matter here.
Still I'm not sure why you want a yet another wrapper. There is no need to expose any methods or internal structure of DateTime except FromStr, Display, From, Into and perhaps a PartialOrd. So both options will look the same from the point of view of a user.
from httpdate.
There is no need to expose any methods or internal structure of DateTime except FromStr, Display, From, Into and perhaps a PartialOrd. So both options will look the same from the point of view of a user.
Ah good idea. So parse_http_date
would return an opaque DateTime
and can be converted to a SystemTime
if necessary. It can also be formatted with Display. Maybe DateTime
is too generic would you agree to name it HttpTime
?
from httpdate.
Yes HttpTime
sounds good.
from httpdate.
While editing the code I noticed that the crate is called httpdate
but the type would be named HttpTime
. Either I need to rename the crate and yank the old version or I should call it HttpDate
.
from httpdate.
For that matter, I think HttpDate
is equally meaningful as HttpTime
:)
from httpdate.
Sorry for the delay, can you please have a look at the publicdate branch? I will release it after your review.
from httpdate.
Looks good. Thanks!
from httpdate.
Published as v0.3.0
from httpdate.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpdate.