Code Monkey home page Code Monkey logo

Comments (11)

jhpratt avatar jhpratt commented on May 28, 2024 1

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.

jplatte avatar jplatte commented on May 28, 2024 1

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.

SergioBenitez avatar SergioBenitez commented on May 28, 2024

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.

lnicola avatar lnicola commented on May 28, 2024

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.

jhpratt avatar jhpratt commented on May 28, 2024

@SergioBenitez time's repository mentions that chrono should be used instead, as time is no longer maintained.

from cookie-rs.

SergioBenitez avatar SergioBenitez commented on May 28, 2024

@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.

onx2 avatar onx2 commented on May 28, 2024

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.

jhpratt avatar jhpratt commented on May 28, 2024

@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.

onx2 avatar onx2 commented on May 28, 2024

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.

onx2 avatar onx2 commented on May 28, 2024

Got it, thanks for the clarification! I'll use time for this crate and chrono for the others 😄

from cookie-rs.

TheCGDF avatar TheCGDF commented on May 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.