File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
futures-util/src/future/future Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,32 @@ where
126126 }
127127 None
128128 }
129+
130+ /// Gets the number of strong pointers to this allocation.
131+ ///
132+ /// Returns [`None`] if it has already been polled to completion.
133+ ///
134+ /// # Safety
135+ ///
136+ /// This method by itself is safe, but using it correctly requires extra care. Another thread
137+ /// can change the strong count at any time, including potentially between calling this method
138+ /// and acting on the result.
139+ pub fn strong_count ( & self ) -> Option < usize > {
140+ self . inner . as_ref ( ) . map ( |arc| Arc :: strong_count ( arc) )
141+ }
142+
143+ /// Gets the number of weak pointers to this allocation.
144+ ///
145+ /// Returns [`None`] if it has already been polled to completion.
146+ ///
147+ /// # Safety
148+ ///
149+ /// This method by itself is safe, but using it correctly requires extra care. Another thread
150+ /// can change the weak count at any time, including potentially between calling this method
151+ /// and acting on the result.
152+ pub fn weak_count ( & self ) -> Option < usize > {
153+ self . inner . as_ref ( ) . map ( |arc| Arc :: weak_count ( arc) )
154+ }
129155}
130156
131157impl < Fut > Inner < Fut >
You can’t perform that action at this time.
0 commit comments