summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi_udl/src/literal.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /third_party/rust/uniffi_udl/src/literal.rs
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/uniffi_udl/src/literal.rs')
-rw-r--r--third_party/rust/uniffi_udl/src/literal.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/third_party/rust/uniffi_udl/src/literal.rs b/third_party/rust/uniffi_udl/src/literal.rs
index 78f2544254..5fbf022644 100644
--- a/third_party/rust/uniffi_udl/src/literal.rs
+++ b/third_party/rust/uniffi_udl/src/literal.rs
@@ -84,8 +84,10 @@ pub(super) fn convert_default_value(
(weedle::literal::DefaultValue::String(s), Type::Enum { .. }) => {
Literal::Enum(s.0.to_string(), type_.clone())
}
- (weedle::literal::DefaultValue::Null(_), Type::Optional { .. }) => Literal::Null,
- (_, Type::Optional { inner_type, .. }) => convert_default_value(default_value, inner_type)?,
+ (weedle::literal::DefaultValue::Null(_), Type::Optional { .. }) => Literal::None,
+ (_, Type::Optional { inner_type, .. }) => Literal::Some {
+ inner: Box::new(convert_default_value(default_value, inner_type)?),
+ },
// We'll ensure the type safety in the convert_* number methods.
(weedle::literal::DefaultValue::Integer(i), _) => convert_integer(i, type_)?,
@@ -144,7 +146,7 @@ mod test {
inner_type: Box::new(Type::String)
}
)?,
- Literal::Null
+ Literal::None
));
Ok(())
}