Skip to content

Commit

Permalink
feat: Implement ToStatic for Option<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jul 31, 2024
1 parent 6f50d2a commit f149113
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,14 @@ impl ToStatic for bool {
}
}

impl<T: ToStatic> ToStatic for Option<T> {
type Output = Option<T::Output>;

fn to_static(&self) -> Self::Output {
self.as_ref().map(|v| v.to_static())
}
}

/// Extension trait to provide `to_rust_value` on `JsonValue<'_>`
///
/// Which allows you to do something like:
Expand Down

0 comments on commit f149113

Please sign in to comment.