pub(crate) struct Sender<T, U> {
buffered_once: bool,
giver: Giver,
inner: UnboundedSender<Envelope<T, U>>,
}
Expand description
A bounded sender of requests and callbacks for when responses are ready.
While the inner sender is unbounded, the Giver is used to determine if the Receiver is ready for another request.
Fields§
§buffered_once: bool
One message is always allowed, even if the Receiver hasn’t asked for it yet. This boolean keeps track of whether we’ve sent one without notice.
giver: Giver
The Giver helps watch that the the Receiver side has been polled when the queue is empty. This helps us know when a request and response have been fully processed, and a connection is ready for more.
inner: UnboundedSender<Envelope<T, U>>
Actually bounded by the Giver, plus buffered_once
.
Implementations§
source§impl<T, U> Sender<T, U>
impl<T, U> Sender<T, U>
pub(crate) fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub(crate) fn is_ready(&self) -> bool
pub(crate) fn is_closed(&self) -> bool
fn can_send(&mut self) -> bool
pub(crate) fn try_send( &mut self, val: T, ) -> Result<Receiver<Result<U, (Error, Option<T>)>>, T>
pub(crate) fn send(&mut self, val: T) -> Result<Receiver<Result<U, Error>>, T>
pub(crate) fn unbound(self) -> UnboundedSender<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for Sender<T, U>
impl<T, U> !RefUnwindSafe for Sender<T, U>
impl<T, U> Send for Sender<T, U>
impl<T, U> Sync for Sender<T, U>
impl<T, U> Unpin for Sender<T, U>
impl<T, U> !UnwindSafe for Sender<T, U>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more