pub unsafe trait RawBuffer<S: ?Sized>: Buffer<S> + Clone {
// Required methods
fn into_raw(self) -> *const ();
unsafe fn from_raw(ptr: *const ()) -> Self;
}Available on crate feature
raw-buffer only.Expand description
A buffer that can be stored into a raw pointer.
The trait can be used when the actual buffer is already stored in an Arc.
§Safety
- The slice returned by
Buffer::as_slicemust not be invalidated byinto_raw. from_rawmust be pure, i.e.mem::forget(S::from_raw(ptr))should not invalidate memory behind ptr.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<S: ?Sized, B: Buffer<S> + Sync> RawBuffer<S> for Arc<B>
Available on non-crate feature portable-atomic or crate feature portable-atomic-util only.
impl<S: ?Sized, B: Buffer<S> + Sync> RawBuffer<S> for Arc<B>
Available on non-crate feature
portable-atomic or crate feature portable-atomic-util only.