Skip to main content

Channel

Struct Channel 

Source
pub struct Channel<T, S: SwapSlot<T>> { /* private fields */ }

Implementations§

Source§

impl<T, S: SwapSlot<T>> Channel<T, S>

Source

pub fn broadcast(&self, object: T) -> Result<(), SendError<T>>

Publishes values to the circular buffer at wi % size

§Arguments
  • object - owned object to be published
Source

pub fn try_recv( &self, ri: &AtomicCounter, skip_items: usize, ) -> Result<Arc<T>, TryRecvError>

Receives some atomic reference to an object if queue is not empty, or None if it is. Never Blocks

Source

pub fn close(&self)

Closes the channel

Source

pub fn len(&self) -> usize

Returns the length of the queue

Source

pub fn is_empty(&self) -> bool

Checks if nothings has been published yet

Source

pub fn inc_sub_count(&self)

Increment the number of subs

Source

pub fn dec_sub_count(&self)

Decrement the number of subs

Trait Implementations§

Source§

impl<T: Debug, S: Debug + SwapSlot<T>> Debug for Channel<T, S>

Source§

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

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

impl<T, S: SwapSlot<T>> Drop for Channel<T, S>

Drop trait is used to let subscribers know that publisher is no longer available.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, S> !Freeze for Channel<T, S>

§

impl<T, S> RefUnwindSafe for Channel<T, S>

§

impl<T, S> Send for Channel<T, S>
where T: Send, S: Send,

§

impl<T, S> Sync for Channel<T, S>
where T: Sync, S: Sync,

§

impl<T, S> Unpin for Channel<T, S>
where T: Unpin, S: Unpin,

§

impl<T, S> UnsafeUnpin for Channel<T, S>

§

impl<T, S> UnwindSafe for Channel<T, S>
where T: UnwindSafe, S: UnwindSafe,

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> 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, 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.