Skip to content
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

Serving Pages to the Web in CH2 - 2nd ed #32

Open
Slyfox88 opened this issue Nov 5, 2023 · 0 comments
Open

Serving Pages to the Web in CH2 - 2nd ed #32

Slyfox88 opened this issue Nov 5, 2023 · 0 comments

Comments

@Slyfox88
Copy link

Slyfox88 commented Nov 5, 2023

Running the code around page 18 gives me the following error:

error[E0277]: cannot subtract `chrono::Duration` from `Tm`
cookie.set_expires(time::now() - Duration::days(365));
| ^ no implementation for `Tm - chrono::Duration`
|
= help: the trait `Sub<chrono::Duration>` is not implemented for `Tm`
= help: the following other types implement trait `Sub<Rhs>`:
<Tm as Sub<time::Duration>>
<Tm as Sub>

The compiler doesn't even reach my code, so it must be an issue with dependencies.
Based on this Reddit post, other people are getting the same error:
https://www.reddit.com/r/rust/comments/17djgjd/working_through_programming_rust_2nd_edition_got/

Adding this dependency fixes the issue:
chrono = { version = "= 0.4.29" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant