Struct RwBuffer

Source
pub struct RwBuffer(/* private fields */);
Expand description

A base instance which holds the leaked pointer to RwBufferInner.

This instance can provide either an exclusive write access or multiple read access, but not at the same time. Can be used to store the instance. This instance is Send and Sync because the insternals are guarded by ordered atomic operations.

Implementations§

Source§

impl RwBuffer

Source

pub fn is_free(&self) -> bool

Checks if this instance satisfies the following conditions:

  • No exclusive write access

  • No read access

  • There is only one base reference.

§Returns
    • true if instance satisfies the conditions above.
    • false if does not satisfy the conditions above.
Source

pub fn accure_if_free(&self) -> bool

Accures the instance, if it satisfy the following conditions:

  • No exclusive write access

  • No read access

  • There is only one base reference.

§Returns
    • true if instance satisfies the conditions above.
    • false if does not satisfy the conditions above.
Source

pub fn write(&self) -> RwBufferRes<WBuffer>

Attemts to make an exclusive (write) access to the buffer.

§Returns

A Result in form of RwBufferRes is returned with:

Source

pub fn read(&self) -> RwBufferRes<RBuffer>

Attemts to make a shared (read) access to the buffer.

§Returns

A Result in form of RwBufferRes is returned with:

Trait Implementations§

Source§

impl Clone for RwBuffer

Source§

fn clone(&self) -> Self

Clones the instance and increasing the base ref count.

Will panic if a soft limit of refs were reached.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RwBuffer

Source§

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

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

impl Drop for RwBuffer

Source§

fn drop(&mut self)

Drops the RwBuffer instance. In case if there is no readers and writers, then drop immidiatly the inner data. In case if there is any readers or writing, then drop only wrapper which is the zero reader.

Source§

impl PartialEq for RwBuffer

Source§

fn eq(&self, other: &RwBuffer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for RwBuffer

Source§

impl Send for RwBuffer

Source§

impl StructuralPartialEq for RwBuffer

Source§

impl Sync for RwBuffer

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.