Comments (11)
I'm not a maintainer, but I'm pretty sure that's something that wouldn't even be feasible. sqlx and async-graphql use the feature flags to enable third-party implementations whereas cookie relies on it in the API itself — basically you couldn't have both enabled at the same time, and the features wouldn't be additive as required by cargo.
There's nothing wrong with using both crates, though I can imagine it may get a little confusing at times.
from cookie-rs.
Coming back to this, how about continuing to use time
internally for ergonomics, but removing it from the public API? I don't see how time's Duration
that allows negative values is useful for setting max-age
. Mabye there's other uses of time
types in public API?
from cookie-rs.
In general, time
on crates is a maintained/expanded version of std::time
. It's got a bunch of helpful functions and methods that std::time
doesn't, and it's generally agreed that one should use time
over std::time
.
from cookie-rs.
In general, time on crates is a maintained/expanded version of std::time.
That's not how I see it; the repository is at rust-lang-deprecated/time
and the README says:
This library is no longer actively maintained, but bugfixes will be added (details).
it's generally agreed that one should use time over std::time.
Maybe, but I've never seen that advice.
It's got a bunch of helpful functions
Got it, strptime
and strftime
. There's no equivalent functionality in std::time
.
from cookie-rs.
@SergioBenitez time
's repository mentions that chrono
should be used instead, as time
is no longer maintained.
from cookie-rs.
@jhpratt Certainly, but chrono
is a much bigger, much more opinionated crate than we need. That being said, I have no strong opinions on the matter. As long as it is user-friendly, I'm open to migration PRs.
from cookie-rs.
Is it possible to use chrono
with this crate? It seems to be the recommendation for other crates like sqlx
and async-graphql
or at least they support it and document how to use. I'm trying to set the expiry for a cookie and it requires OffsetDateTime
which doesn't exist in chrono
. Should I use two date time packages to work around this?
If I have an expiry on a redis session, can I ignore the cookie expiry?
from cookie-rs.
@onx2 I actually wound up taking over the time crate shortly after my previous comment. It's now a rough equal to chrono, so no reason to avoid one or the other.
from cookie-rs.
It seems like all the other packages I'm using prefer chrono
or at least provide a feature for it. Would it be possible to add the feature for chrono
or time
to this package? Or if that's something you don't want to do, would you suggest using both time
and chrono
? For example, async-graphql
and sqlx
both use chrono
.
from cookie-rs.
Got it, thanks for the clarification! I'll use time
for this crate and chrono
for the others 😄
from cookie-rs.
@jhpratt Certainly, but
chrono
is a much bigger, much more opinionated crate than we need. That being said, I have no strong opinions on the matter. As long as it is user-friendly, I'm open to migration PRs.
Using different packages makes others write more codes to cast types.
Your cookie-rs
keeps small and others' codes got bigger.
I still think excessive pursuit of lightweight is toxic.
from cookie-rs.
Related Issues (20)
- Nightly detection does not take into account whether features can actually be used HOT 9
- Panic when verifying malformed signed cookie HOT 2
- Parse multiple cookies in single string? HOT 1
- 0.16 release HOT 3
- Replace base64 with base64ct HOT 5
- Iterator over all cookies from string HOT 1
- Removing cookies by name HOT 4
- Private, signed & key methods missing
- Why was ring removed? HOT 1
- Commas are not encoded correctly
- Cookie builder doesn't ignore leading dots (as the `FromStr` implementation does) HOT 4
- Use `std::time::Duration` instead of `time::duration::Duration` for `max-age` HOT 1
- Trait bound error after upgrading to 0.17.0 HOT 1
- Support for `__Host-` cookies HOT 4
- Set Removal Cookies SameSite to Lax HOT 3
- Question : SignedJar::verify_result HOT 2
- aes-gcm vulnerability HOT 1
- Additional Message Data for signing only. HOT 3
- Does cookie-rs support cookie "Partitioned" yet, please? HOT 1
- Custom Extensions in the Set-Cookie String
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 cookie-rs.