File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,18 @@ macro_rules! rc_borrow {
162
162
unsafe { & * this. raw. as_ptr( ) }
163
163
}
164
164
165
+ /// Get the number of strong owning pointers to this allocation.
166
+ $vis fn strong_count( this: Self ) -> usize {
167
+ let rc = unsafe { ManuallyDrop :: new( $Rc:: from_raw( Self :: into_raw( this) ) ) } ;
168
+ $Rc:: strong_count( & rc)
169
+ }
170
+
171
+ /// Get the number of weak owning pointers to this allocation.
172
+ $vis fn weak_count( this: Self ) -> usize {
173
+ let rc = unsafe { ManuallyDrop :: new( $Rc:: from_raw( Self :: into_raw( this) ) ) } ;
174
+ $Rc:: weak_count( & rc)
175
+ }
176
+
165
177
/// Get a raw pointer that can be used with `from_raw`.
166
178
$vis fn into_raw( this: Self ) -> * const T {
167
179
ManuallyDrop :: new( this) . raw. as_ptr( )
You can’t perform that action at this time.
0 commit comments