From f14911329eeafc154145d30f4e10df0f78e77a1b Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Wed, 31 Jul 2024 12:09:53 +0200 Subject: [PATCH] feat: Implement ToStatic for Option --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ecbe1ef..a59e6fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1306,6 +1306,14 @@ impl ToStatic for bool { } } +impl ToStatic for Option { + type Output = Option; + + 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: