Skip to content

Commit

Permalink
Add ref Option conversion into ScVal
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Nov 11, 2023
1 parent 9c97e4f commit 40f4fa8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/curr/scval_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,18 @@ impl<T: Into<ScVal>> From<Option<T>> for ScVal {
}
}

impl<T> From<&Option<T>> for ScVal
where
for<'a> &'a T: Into<ScVal>,
{
fn from(v: &Option<T>) -> Self {
match v {
Some(v) => v.into(),
None => ().into(),
}
}
}

macro_rules! impl_for_tuple {
( $count:literal $($typ:ident $idx:tt)+ ) => {
#[cfg(feature = "alloc")]
Expand Down

0 comments on commit 40f4fa8

Please sign in to comment.