Skip to content

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

Open
@Slyfox88

Description

@Slyfox88

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" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions