pub struct AtomicBuffer { /* private fields */ }Expand description
Wraps but does not own a region of shared memory
Implementations§
Source§impl AtomicBuffer
impl AtomicBuffer
pub fn from_aligned(aligned: &AlignedBuffer) -> AtomicBuffer ⓘ
pub fn wrap(buffer: AtomicBuffer) -> Self
pub fn wrap_slice(slice: &mut [u8]) -> Self
Sourcepub fn view(&self, offset: Index, len: Index) -> Self
pub fn view(&self, offset: Index, len: Index) -> Self
Create a view on the contents of the buffer starting from offset and spanning len bytes. Sets length of the “view” buffer to “len”
pub const fn capacity(&self) -> Index
pub fn bounds_check(&self, idx: Index, len: Index)
pub fn get<T: Copy>(&self, position: Index) -> T
pub fn overlay_struct<T>(&self, position: Index) -> *mut T
pub fn as_ref<T: Copy>(&self, position: Index) -> &T
pub fn buffer(&self) -> *mut u8
pub fn set_memory(&self, position: Index, len: Index, value: u8)
pub fn get_volatile<T: Copy>(&self, position: Index) -> T
pub fn put_ordered<T>(&self, position: Index, val: T)
pub fn put<T>(&self, position: Index, val: T)
pub fn put_atomic_i64(&self, offset: Index, val: i64)
pub fn compare_and_set_i32( &self, position: Index, expected: i32, update: i32, ) -> bool
pub fn compare_and_set_i64( &self, position: Index, expected: i64, update: i64, ) -> bool
Sourcepub fn add_i64_ordered(&self, offset: Index, delta: i64)
pub fn add_i64_ordered(&self, offset: Index, delta: i64)
Single threaded increment with release semantics.
@param offset in the buffer of the word. @param delta for to be applied to the value.
Sourcepub fn put_bytes(&self, offset: Index, src: &[u8])
pub fn put_bytes(&self, offset: Index, src: &[u8])
Put bytes in to this buffer at specified offset
pub fn get_bytes(&self, offset: Index, dest: *mut u8, length: Index)
Sourcepub fn copy_from(
&self,
offset: Index,
src_buffer: &AtomicBuffer,
src_offset: Index,
length: Index,
)
pub fn copy_from( &self, offset: Index, src_buffer: &AtomicBuffer, src_offset: Index, length: Index, )
Copy “length” bytes from “src_buffer” starting from “src_offset” in to this buffer at given “offset” offset - offset in current (self) buffer to start coping from src_buffer - atomic buffer to copy data from src_offset - offset in src_buffer to start coping from length - number of bytes to copy
pub fn as_mutable_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_sub_slice(&self, index: Index, len: Index) -> &[u8] ⓘ
pub fn get_string(&self, offset: Index) -> CString
pub fn get_string_without_length(&self, offset: Index, length: Index) -> CString
pub fn get_string_length(&self, offset: Index) -> Index
Sourcepub fn put_string(&self, offset: Index, string: &[u8])
pub fn put_string(&self, offset: Index, string: &[u8])
This function expects ASCII string WITHOUT trailing zero as its input.
pub fn put_string_without_length(&self, offset: Index, string: &[u8]) -> Index
Sourcepub fn get_and_add_i64(&self, offset: Index, delta: i64) -> i64
pub fn get_and_add_i64(&self, offset: Index, delta: i64) -> i64
Multi threaded increment.
@param offset in the buffer of the word. @param delta for to be applied to the value. @return the value before applying the delta.
Trait Implementations§
Source§impl Clone for AtomicBuffer
impl Clone for AtomicBuffer
impl Copy for AtomicBuffer
Source§impl Debug for AtomicBuffer
impl Debug for AtomicBuffer
Source§impl Write for AtomicBuffer
impl Write for AtomicBuffer
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Source§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)