Make Option<T: Finalize> implement Finalize
@@ -370,7 +370,7 @@ impl<T: Finalize> Finalize for Vec<T> {
}
}
-// Smart Pointers
+// Smart pointers and other wrappers
impl<T: Finalize> Finalize for std::boxed::Box<T> {
fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
@@ -378,6 +378,14 @@ impl<T: Finalize> Finalize for std::boxed::Box<T> {
}
}
+impl<T: Finalize> Finalize for Option<T> {
+ fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
+ if let Some(v) = self {
+ v.finalize(cx);
+ }
+ }
+}
+
impl<T: Finalize> Finalize for std::rc::Rc<T> {
fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
if let Ok(v) = std::rc::Rc::try_unwrap(self) {
