Struct AtomicBuffer

Source
pub struct AtomicBuffer { /* private fields */ }
Expand description

Wraps but does not own a region of shared memory

Implementations§

Source§

impl AtomicBuffer

Source

pub fn from_aligned(aligned: &AlignedBuffer) -> AtomicBuffer

Source

pub fn wrap(buffer: AtomicBuffer) -> Self

Source

pub fn wrap_slice(slice: &mut [u8]) -> Self

Source

pub fn wrap_raw_slice(slice: *mut [u8]) -> Self

Source

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”

Source

pub const fn capacity(&self) -> Index

Source

pub fn bounds_check(&self, idx: Index, len: Index)

Source

pub fn get<T: Copy>(&self, position: Index) -> T

Source

pub fn overlay_struct<T>(&self, position: Index) -> *mut T

Source

pub fn as_ref<T: Copy>(&self, position: Index) -> &T

Source

pub fn buffer(&self) -> *mut u8

Source

pub fn set_memory(&self, position: Index, len: Index, value: u8)

Source

pub fn get_volatile<T: Copy>(&self, position: Index) -> T

Source

pub fn put_ordered<T>(&self, position: Index, val: T)

Source

pub fn put<T>(&self, position: Index, val: T)

Source

pub fn put_atomic_i64(&self, offset: Index, val: i64)

Source

pub fn compare_and_set_i32( &self, position: Index, expected: i32, update: i32, ) -> bool

Source

pub fn compare_and_set_i64( &self, position: Index, expected: i64, update: i64, ) -> bool

Source

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.

Source

pub fn put_bytes(&self, offset: Index, src: &[u8])

Put bytes in to this buffer at specified offset

Source

pub fn get_bytes<T>(&self, offset: Index, dest: &mut T)

Source

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

Source

pub fn as_mutable_slice(&mut self) -> &mut [u8]

Source

pub fn as_slice(&self) -> &[u8]

Source

pub fn as_sub_slice(&self, index: Index, len: Index) -> &[u8]

Source

pub fn get_string(&self, offset: Index) -> CString

Source

pub fn get_string_without_length(&self, offset: Index, length: Index) -> CString

Source

pub fn get_string_length(&self, offset: Index) -> Index

Source

pub fn put_string(&self, offset: Index, string: &[u8])

This function expects ASCII string WITHOUT trailing zero as its input.

Source

pub fn put_string_without_length(&self, offset: Index, string: &[u8]) -> Index

Source

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

Source§

fn clone(&self) -> AtomicBuffer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AtomicBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Write for AtomicBuffer

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<(), Error>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl Copy for AtomicBuffer

Source§

impl Send for AtomicBuffer

Source§

impl Sync for AtomicBuffer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V