pub trait AtomicSliceOps {
// Required methods
unsafe fn atomic_read_ptr(&self, dest: *mut u8, len: usize);
unsafe fn atomic_write_ptr(&self, src: *const u8, len: usize);
fn atomic_fill(&self, value: u8);
fn as_atomic<T: Atomic>(&self) -> Option<&T>;
fn as_atomic_slice<T: Atomic>(&self) -> Option<&[T]>;
// Provided methods
fn atomic_read(&self, dest: &mut [u8]) { ... }
fn atomic_read_obj<T: FromBytes + Immutable + KnownLayout>(&self) -> T { ... }
fn atomic_write(&self, src: &[u8]) { ... }
fn atomic_write_obj<T: IntoBytes + Immutable + KnownLayout>(&self, obj: &T) { ... }
}
Required Methods§
Sourceunsafe fn atomic_read_ptr(&self, dest: *mut u8, len: usize)
unsafe fn atomic_read_ptr(&self, dest: *mut u8, len: usize)
Sourceunsafe fn atomic_write_ptr(&self, src: *const u8, len: usize)
unsafe fn atomic_write_ptr(&self, src: *const u8, len: usize)
Sourcefn atomic_fill(&self, value: u8)
fn atomic_fill(&self, value: u8)
Fills the slice with value
.
fn as_atomic<T: Atomic>(&self) -> Option<&T>
fn as_atomic_slice<T: Atomic>(&self) -> Option<&[T]>
Provided Methods§
Sourcefn atomic_read(&self, dest: &mut [u8])
fn atomic_read(&self, dest: &mut [u8])
Reads from the slice into dest
.
Panics if the slice is not the same size as dest
.
Sourcefn atomic_read_obj<T: FromBytes + Immutable + KnownLayout>(&self) -> T
fn atomic_read_obj<T: FromBytes + Immutable + KnownLayout>(&self) -> T
Reads an object from the slice.
Panics if the slice is not the same size as T
.
Sourcefn atomic_write(&self, src: &[u8])
fn atomic_write(&self, src: &[u8])
Writes src
to the slice.
Panics if the slice is not the same size as src
.
Sourcefn atomic_write_obj<T: IntoBytes + Immutable + KnownLayout>(&self, obj: &T)
fn atomic_write_obj<T: IntoBytes + Immutable + KnownLayout>(&self, obj: &T)
Writes an object to the slice.
Panics if the slice is not the same size as T
.
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.