toml: fix custom to_toml
for complex structs
#19338
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quickfix for #19300
馃 Generated by Copilot at 83c267e
This pull request enhances the
toml
module to support custom encoding of complex structs using theto_toml
method. It also fixes the encoding of nested structs in arrays, and adds a test case for the new functionality.馃 Generated by Copilot at 83c267e
to_toml
method (link, link)to_toml
method for theExample
struct invlib/toml/tests/encode_and_decode_test.v
and assert that it matches the output oftoml.encode
(link)encode_struct
function invlib/toml/toml.v
to check for nested structs in arrays and use theto_toml
method if available, or theencode_struct
function otherwise (link)Date
,Time
, andDateTime
structs, which are already encoded by thetoml
module (link)