Struct crossmist::Duplex

source ·
pub struct Duplex<S: Object, R: Object> { /* private fields */ }
Expand description

A side of a bidirectional channel.

S is the type of the objects this side sends via the channel and the other side receives, R is the type of the objects the other side sends via the channel and this side receives.

Implementations§

source§

impl<S: Object, R: Object> Duplex<S, R>

source

pub fn send(&mut self, value: &S) -> Result<()>

Send a value to the other side.

source

pub fn recv(&mut self) -> Result<Option<R>>

Receive a value from the other side.

Returns Ok(None) if the other side has dropped the channel.

source

pub fn request(&mut self, value: &S) -> Result<R>

Send a value from the other side and wait for a response immediately.

If the other side closes the channel before responding, an error is returned.

Trait Implementations§

source§

impl<S: Object, R: Object> AsRawFd for Duplex<S, R>

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl<S: Object, R: Object> From<Duplex<S, R>> for Duplex<S, R>

Available on crate feature tokio only.
source§

fn from(value: Duplex<S, R>) -> Self

Converts to this type from the input type.
source§

impl<S: Object, R: Object> From<Duplex<S, R>> for Duplex<S, R>

Available on crate feature tokio only.
source§

fn from(value: Duplex<S, R>) -> Self

Converts to this type from the input type.
source§

impl<S: Object, R: Object> FromRawFd for Duplex<S, R>

source§

unsafe fn from_raw_fd(fd: RawFd) -> Self

Constructs a new instance of Self from the given raw file descriptor. Read more
source§

impl<S: Object, R: Object> IntoRawFd for Duplex<S, R>

source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more
source§

impl<S: Object, R: Object> Object for Duplex<S, R>

source§

fn serialize_self(&self, s: &mut Serializer)

source§

fn deserialize_self(d: &mut Deserializer) -> Self

source§

fn deserialize_on_heap<'serde>( &self, d: &mut Deserializer ) -> Box<dyn Object + 'serde>where Self: 'serde,

Auto Trait Implementations§

§

impl<S, R> RefUnwindSafe for Duplex<S, R>

§

impl<S, R> Send for Duplex<S, R>

§

impl<S, R> Sync for Duplex<S, R>

§

impl<S, R> Unpin for Duplex<S, R>

§

impl<S, R> UnwindSafe for Duplex<S, R>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsRawHandle for Twhere T: AsRawFd,

source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> FromRawHandle for Twhere T: FromRawFd,

source§

unsafe fn from_raw_handle(handle: RawHandle) -> Selfwhere Self: Sized,

source§

impl<T, U> Into<U> for Twhere 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> IntoRawHandle for Twhere T: IntoRawFd,

source§

fn into_raw_handle(self) -> RawHandlewhere Self: Sized,

source§

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

§

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 Twhere U: TryFrom<T>,

§

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.