We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Arc::as_ptr
1 parent 89c4ba7 commit 0017bc4Copy full SHA for 0017bc4
src/sync/arc.rs
@@ -75,9 +75,14 @@ impl<T> Arc<T> {
75
76
/// Consumes the `Arc`, returning the wrapped pointer.
77
pub fn into_raw(this: Self) -> *const T {
78
- let ptr = &*this as *const _;
+ let ptr = Self::as_ptr(&this);
79
mem::forget(this);
80
- ptr as *const T
+ ptr
81
+ }
82
+
83
+ /// Provides a raw pointer to the data.
84
+ pub fn as_ptr(this: &Self) -> *const T {
85
+ std::sync::Arc::as_ptr(&this.inner) as *const T
86
}
87
88
/// Constructs an `Arc` from a raw pointer.
0 commit comments