Extended the documentation for Arc's Weak::upgrade

This commit is contained in:
Sergey Ivanov
2026-04-17 07:47:34 +00:00
parent 4c4205163a
commit f580872fe2
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -3501,7 +3501,13 @@ pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self {
/// Attempts to upgrade the `Weak` pointer to an [`Rc`], delaying
/// dropping of the inner value if successful.
///
/// Returns [`None`] if the inner value has since been dropped.
/// Returns [`None`] in the following cases:
///
/// 1. The inner value has since been dropped or moved out.
///
/// 2. This `Weak` does not point to an allocation.
///
/// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade.
///
/// # Examples
///
+7 -1
View File
@@ -3232,7 +3232,13 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
/// Attempts to upgrade the `Weak` pointer to an [`Arc`], delaying
/// dropping of the inner value if successful.
///
/// Returns [`None`] if the inner value has since been dropped.
/// Returns [`None`] in the following cases:
///
/// 1. The inner value has since been dropped or moved out.
///
/// 2. This `Weak` does not point to an allocation.
///
/// 3. The owning reference this `Weak` is associated with is either not fully-constructed or does not allow an upgrade.
///
/// # Examples
///