-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Since Opt<T>
only checks for the absence of an argument, it does not respect passing undefined
explicitly. This is probably the correct implementation:
impl<'cx, T: FromValue<'cx>> FromArgument<'_, 'cx> for Opt<T> {
type Config = T::Config;
fn from_argument(accessor: &mut Accessor<'_, 'cx>, config: Self::Config) -> Result<Opt<T>> {
if accessor.is_empty() {
Ok(Opt(None))
} else {
let val = accessor.value();
if val.handle().is_undefined() {
Ok(Opt(None))
} else {
T::from_value(accessor.cx(), &val, false, config).map(Some).map(Opt)
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels