Skip to content

How can I store the result of format_description::parse in a struct field? #353

Closed Answered by jhpratt
ReagentX asked this question in Question
Discussion options

You must be logged in to vote

Given that you mentioned you want the struct to own everything, this is not possible. Self-referential structs don't exist in Rust, and that's what would be required — the FormatItem::Literal variant would point to the contents of the format field.

I don't think this is the case given what you've stated, but if the format description is statically-known, you can use the time::macros::format_description macro.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ReagentX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #352 on September 26, 2021 01:22.