Skip to content

Commit b7a5449

Browse files
committed
zephyr: sync: Add methods to PinWeak
Add some missing methods to `PinWeak`, notably forwarding `strong_count`, `weak_count`, and `ptr_eq` through to the inner type. Signed-off-by: David Brown <[email protected]>
1 parent 0f75e9e commit b7a5449

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

zephyr/src/sync.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ mod pinweak {
5757
.upgrade()
5858
.map(|arc| unsafe { Pin::new_unchecked(arc) })
5959
}
60+
61+
/// Equivalent to [`Weak::strong_count`]
62+
pub fn strong_count(&self) -> usize {
63+
self.0.strong_count()
64+
}
65+
66+
/// Equivalent to [`Weak::weak_count`]
67+
pub fn weak_count(&self) -> usize {
68+
self.0.weak_count()
69+
}
70+
71+
/// Equivalent to [`Weak::ptr_eq`]
72+
pub fn ptr_eq(&self, other: &Self) -> bool {
73+
self.0.ptr_eq(&other.0)
74+
}
6075
}
6176
}
6277

0 commit comments

Comments
 (0)