mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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:
parent
3faed9b921
commit
c60e4afbee
10 changed files with 124 additions and 129 deletions
|
@ -39,60 +39,6 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
|
||||
use crate::dom::node::{document_from_node, Node, NodeDamage};
|
||||
|
||||
// TODO: make all this derivables available via new Bindings.conf option
|
||||
impl Clone for GPUCanvasConfiguration {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
alphaMode: self.alphaMode,
|
||||
device: self.device.clone(),
|
||||
format: self.format,
|
||||
usage: self.usage,
|
||||
viewFormats: self.viewFormats.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for HTMLCanvasElementOrOffscreenCanvas {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
Self::HTMLCanvasElement(arg0) => Self::HTMLCanvasElement(arg0.clone()),
|
||||
Self::OffscreenCanvas(arg0) => Self::OffscreenCanvas(arg0.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl malloc_size_of::MallocSizeOf for GPUTextureDescriptor {
|
||||
fn size_of(&self, ops: &mut malloc_size_of::MallocSizeOfOps) -> usize {
|
||||
let Self {
|
||||
parent,
|
||||
dimension,
|
||||
format,
|
||||
mipLevelCount,
|
||||
sampleCount,
|
||||
size,
|
||||
usage,
|
||||
viewFormats,
|
||||
} = self;
|
||||
parent.size_of(ops) +
|
||||
dimension.size_of(ops) +
|
||||
format.size_of(ops) +
|
||||
mipLevelCount.size_of(ops) +
|
||||
sampleCount.size_of(ops) +
|
||||
size.size_of(ops) +
|
||||
usage.size_of(ops) +
|
||||
viewFormats.size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
impl malloc_size_of::MallocSizeOf for HTMLCanvasElementOrOffscreenCanvas {
|
||||
fn size_of(&self, ops: &mut malloc_size_of::MallocSizeOfOps) -> usize {
|
||||
match self {
|
||||
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => canvas.size_of(ops),
|
||||
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => canvas.size_of(ops),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLCanvasElementOrOffscreenCanvas {
|
||||
fn size(&self) -> Size2D<u64> {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue