PacktPublishing / Rust-Web-Programming-2nd-Edition

Rust Web Programming - Second Edition, published by Packt
MIT License
120 stars 38 forks source link

Serving Pages to the Web in CH2 #8

Closed Slyfox88 closed 1 year ago

Slyfox88 commented 1 year ago

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/

Slyfox88 commented 1 year ago

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