rename take to manually drop
This commit is contained in:
1 parent
60a84956d1
commit
5f9e5f607b
4 files changed
+11
-11
No files matched your search
@@ -186,8 +186,8 @@ impl<T: 'static, S: Storage<T>> GenerationalBox<T, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Take the value out of the generational box and invalidate the generational box. This will return the value if the value was taken.
|
/// Drop the value out of the generational box and invalidate the generational box. This will return the value if the value was taken.
|
||||||
pub fn take(&self) -> Option<T> {
|
pub fn manually_drop(&self) -> Option<T> {
|
||||||
if self.validate() {
|
if self.validate() {
|
||||||
Storage::take(&self.raw.0.data)
|
Storage::take(&self.raw.0.data)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -190,11 +190,9 @@ impl<T: 'static, S: Storage<T>> CopyValue<T, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Take the value out of the CopyValue, invalidating the value in the process.
|
/// Manually drop the value in the CopyValue, invalidating the value in the process.
|
||||||
pub fn take(&self) -> T {
|
pub fn manually_drop(&self) -> Option<T> {
|
||||||
self.value
|
self.value.manually_drop()
|
||||||
.take()
|
|
||||||
.expect("value is already dropped or borrowed")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the scope this value was created in.
|
/// Get the scope this value was created in.
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ impl<T: 'static, S: Storage<SignalData<T>>> ReadOnlySignal<T, S> {
|
|||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
/// This should only be used by the `rsx!` macro.
|
/// This should only be used by the `rsx!` macro.
|
||||||
pub fn __take(&self) -> T {
|
pub fn __take(&self) -> T {
|
||||||
self.inner.take()
|
self.inner
|
||||||
|
.manually_drop()
|
||||||
|
.expect("Signal has already been dropped")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ impl<T: 'static, S: Storage<SignalData<T>>> Signal<T, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Take the value out of the signal, invalidating the signal in the process.
|
/// Drop the value out of the signal, invalidating the signal in the process.
|
||||||
pub fn take(&self) -> T {
|
pub fn manually_drop(&self) -> Option<T> {
|
||||||
self.inner.take().value
|
self.inner.manually_drop().map(|i| i.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the scope the signal was created in.
|
/// Get the scope the signal was created in.
|
||||||
|
|||||||
Reference in new issue
Block a user