From b7ccb248480918ae589756b585f4cdcae82a26b7 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Tue, 22 May 2018 16:59:53 -0700 Subject: [PATCH] Add PinMut::set --- src/libcore/mem.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 116e56f4ae9f..059c099d66b5 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1164,6 +1164,14 @@ impl<'a, T: ?Sized> PinMut<'a, T> { { PinMut { inner: f(this.inner) } } + + /// Assign a new value to the memory behind the pinned reference. + #[unstable(feature = "pin", issue = "49150")] + pub fn set(this: PinMut<'a, T>, value: T) + where T: Sized, + { + *this.inner = value; + } } #[unstable(feature = "pin", issue = "49150")]