Support custom derives for generated types (#34356)

* script: Derive more Default implementations for dictionaries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives on generated enums.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives for generated dictionaries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Support arbitrary derives for generated unions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Derive more impls for generated dicts and unions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Implement FromStr for generated enums.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* crown: Allow returning unrooted values from Default::default.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-11-24 13:15:50 -05:00 committed by GitHub
parent 3faed9b921
commit c60e4afbee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 124 additions and 129 deletions

View file

@ -527,3 +527,49 @@ DOMInterfaces = {
},
}
Dictionaries = {
'GPUCanvasConfiguration': {
'derives': ['Clone']
},
'GPUExtent3DDict': {
'derives': ["MallocSizeOf"],
},
'GPUObjectDescriptorBase': {
'derives': ['MallocSizeOf']
},
'GPUTextureDescriptor': {
'derives': ["MallocSizeOf"],
},
'HeadersInit': {
'derives': ["Clone"],
},
}
Enums = {
'GPUFeatureName': {
'derives': ['Hash', 'Eq']
}
}
Unions = {
'ByteStringSequenceSequenceOrByteStringByteStringRecord': {
'derives': ['Clone']
},
'HTMLCanvasElementOrOffscreenCanvas': {
'derives': ['Clone', 'MallocSizeOf']
},
'RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict': {
'derives': ['MallocSizeOf']
},
'StringOrUnsignedLong': {
'derives': ['Clone'],
},
}