time
time copied to clipboard
How to use `serde::format_description` with `format_description::well_known` ?
I wanna map "non-offset" strings against OffsetDatetime
.
I tried (sorry not provided Rust Playground links, but seems it lacks some features):
use time;
time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
But I get following errors:
error: expected one of `::`, `;`, or `as`, found `.`
--> konfetti-sessionize/src/lib.rs:2:111
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^ expected one of `::`, `;`, or `as`
error: macro expansion ignores token `}` and any following
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ caused by the macro expansion here
|
= note: the usage of `time::serde::format_description!` is likely invalid in item context
error[E0433]: failed to resolve: there are too many leading `super` keywords
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ there are too many leading `super` keywords
|
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0432]: unresolved import `super`
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `description` in the root
|
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `__path_hack`
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `__path_hack`
|
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `__TimeSerdeType` in this scope
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find function `description` in this scope
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
note: function `crate::serde_datetime::description` exists but is inaccessible
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `__TimeSerdeType`
--> konfetti-sessionize/src/lib.rs:2:1
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601.DATE_TIME);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `__TimeSerdeType`
|
= note: this error originates in the macro `time::serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
Trying to replace Iso8601.DATE_TIME
with Iso8601::DATE_TIME
, blocks macro evaluation:
error[E0432]: unresolved import `time::format_description::well_known::Iso8601`
--> konfetti-sessionize/src/lib.rs:2:104
|
2 | time::serde::format_description!(serde_datetime, OffsetDateTime, time::format_description::well_known::Iso8601::DATE_TIME);
| ^^^^^^^ `Iso8601` is a struct, not a module