add support for deserializing a map with int keys as a sequence

This commit is contained in:
Robin Appelman 2025-06-05 20:42:13 +02:00
commit b928f85df6
14 changed files with 226 additions and 9 deletions

View file

@ -0,0 +1,11 @@
---
source: tests/serde.rs
expression: result
---
{
"MapArray": {
"0": "foo",
"1": "bar",
"2": "asd",
},
}

View file

@ -0,0 +1,9 @@
---
source: tests/serde.rs
expression: material
---
MapArray([
"foo",
"bar",
"asd",
])

View file

@ -0,0 +1,9 @@
---
source: tests/serde.rs
expression: result
---
MapArray([
"foo",
"bar",
"asd",
])

View file

@ -0,0 +1,14 @@
---
source: tests/serde.rs
expression: out
---
vmt_reader::unexpected_token
× Invalid array key 3, expected 2
╭─[5:3]
4 │ "1" "bar"
5 │ "3" "asd"
· ─┬─
· ╰── Invalid array key 3, expected 2
6 │ }
╰────

View file

@ -4,11 +4,10 @@ expression: out
---
vmt_parser::unknown_variant
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap
× Unknown variant "Resource" expected on of expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap, MapArray
╭─[1:1]
1 │ "Resource"
· ─────┬────
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap
· ╰── expected on of Types, LightmappedGeneric, Resource/specificPanel.res, UserConfigData, Sprite, EnumInMap, MapArray
2 │ {
╰────