aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 8cfd491ebdb..a20dc523357 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -945,8 +945,10 @@ for (uint32_t i = 0; i < length; ++i) {
# Set up some sensible defaults for these things insofar as we can.
holderType = None
- if argIsPointer:
+ initialValue = None
+ if argIsPointer or isOptional:
declType = "Option<" + typePtr + ">"
+ initialValue = "None"
else:
declType = typePtr
@@ -995,7 +997,7 @@ for (uint32_t i = 0; i < length; ++i) {
declType = CGGeneric(declType)
if holderType is not None:
holderType = CGGeneric(holderType)
- return (templateBody, declType, holderType, isOptional, None)
+ return (templateBody, declType, holderType, isOptional, initialValue)
if type.isSpiderMonkeyInterface():
assert not isEnforceRange and not isClamp