Struct Channel

Source
pub struct Channel<T>(/* private fields */);
Expand description

A channel for passing messages between fibers. This api is backed by the tarantool fiber_channel api which is not awailable in all versions of tarantool. Use tarantool::ffi::has_fiber_channel to check if it is supported in your case. If has_fiber_channel returns false, using any function from this module will result in a panic.

Implementations§

Source§

impl<T> Channel<T>

Source

pub fn new(size: u32) -> Self

Source

pub fn close(self)

Source

pub fn is_closed(&self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn size(&self) -> u32

Source

pub fn count(&self) -> u32

Source

pub fn has_readers(&self) -> bool

Source

pub fn has_writers(&self) -> bool

Source§

impl<T> Channel<T>

Source

pub unsafe extern "C" fn destroy_msg(msg: *mut ipc_msg)

§Safety

msg must have been created with ffi::ipc_value_new

Source§

impl<T> Channel<T>

Source

pub fn iter(&self) -> Iter<'_, T>

Source

pub fn try_iter(&self) -> TryIter<'_, T>

Source§

impl<T> Channel<T>

Source

pub fn send(&self, t: T) -> Result<(), T>
where T: 'static,

Source

pub fn send_timeout(&self, t: T, timeout: Duration) -> Result<(), SendError<T>>
where T: 'static,

Source

pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
where T: 'static,

Source

pub fn recv(&self) -> Option<T>

Source

pub fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvError>

Source

pub fn try_recv(&self) -> Result<T, TryRecvError>

Trait Implementations§

Source§

impl<T> Clone for Channel<T>

Source§

fn clone(&self) -> Self

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

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Channel<T>

Source§

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

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

impl<'a, T> IntoIterator for &'a Channel<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for Channel<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more
Source§

impl<T> RecvTimeout<T> for Channel<T>

Source§

fn recv_maybe_timeout(&self, timeout: Option<Duration>) -> Result<T, RecvError>

Receive a message from the channel. Read more
Source§

fn recv(&self) -> Option<T>

Source§

fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvError>

Source§

fn try_recv(&self) -> Result<T, TryRecvError>

Source§

impl<T> SendTimeout<T> for Channel<T>

Source§

fn send_maybe_timeout( &self, t: T, timeout: Option<Duration>, ) -> Result<(), SendError<T>>
where T: 'static,

Send a message t over the channel. Read more
Source§

fn send(&self, t: T) -> Result<(), T>
where T: 'static,

Source§

fn send_timeout(&self, t: T, timeout: Duration) -> Result<(), SendError<T>>
where T: 'static,

Source§

fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
where T: 'static,

Auto Trait Implementations§

§

impl<T> Freeze for Channel<T>

§

impl<T> RefUnwindSafe for Channel<T>
where T: RefUnwindSafe,

§

impl<T> !Send for Channel<T>

§

impl<T> !Sync for Channel<T>

§

impl<T> Unpin for Channel<T>

§

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

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> IntoClones<(T,)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.