Skip to content

Commit

Permalink
allow fallible args_with
Browse files Browse the repository at this point in the history
  • Loading branch information
dherman committed Sep 28, 2024
1 parent 84ee9ec commit 2158281
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/neon/src/types_impl/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,26 @@ where
{
}

impl<'cx, T, E> private::TryIntoArgumentsInternal<'cx> for Result<T, E>
where
T: private::TryIntoArgumentsInternal<'cx>,
E: TryIntoJs<'cx>,
{
fn try_into_args_vec(self, cx: &mut Cx<'cx>) -> NeonResult<private::ArgsVec<'cx>> {
match self {
Ok(v) => v.try_into_args_vec(cx),
Err(err) => err.try_into_js(cx).and_then(|err| cx.throw(err)),
}
}
}

impl<'cx, T, E> TryIntoArguments<'cx> for Result<T, E>
where
T: TryIntoArguments<'cx>,
E: TryIntoJs<'cx>,
{
}

macro_rules! impl_into_arguments_expand {
{
$(#[$attrs:meta])?
Expand Down

0 comments on commit 2158281

Please sign in to comment.