We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f706aa2 + db4c0de commit 091421bCopy full SHA for 091421b
src/update.rs
@@ -360,3 +360,20 @@ tuple_impl!(A, B, C, D, E, F, G, H, I; a, b, c, d, e, f, g, h, i);
360
tuple_impl!(A, B, C, D, E, F, G, H, I, J; a, b, c, d, e, f, g, h, i, j);
361
tuple_impl!(A, B, C, D, E, F, G, H, I, J, K; a, b, c, d, e, f, g, h, i, j, k);
362
tuple_impl!(A, B, C, D, E, F, G, H, I, J, K, L; a, b, c, d, e, f, g, h, i, j, k, l);
363
+
364
+unsafe impl<T> Update for Option<T>
365
+where
366
+ T: Update,
367
+{
368
+ unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
369
+ let old_value = unsafe { &mut *old_pointer };
370
+ match (old_value, new_value) {
371
+ (Some(old), Some(new)) => T::maybe_update(old, new),
372
+ (None, None) => false,
373
+ (old_value, new_value) => {
374
+ *old_value = new_value;
375
+ true
376
+ }
377
378
379
+}
0 commit comments