Skip to content

Commit

Permalink
docs: Fix inaccuracies around send
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzbilgener committed Apr 2, 2021
1 parent d282479 commit bfe74a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ async fn main() {

#### Unbounded Channel

There is also an unbounded alternative, `bmrng::unbounded_channel()` with non-blocking `.send()` calls.
There is also an unbounded alternative, `bmrng::unbounded_channel()` with sync `.send()` calls.
4 changes: 2 additions & 2 deletions src/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<Req, Res> RequestSender<Req, Res> {
///
/// Return the [`ResponseReceiver`] which can be used to wait for a response
///
/// This call blocks if the request channel is full. It does not wait for a response
/// This call waits if the request channel is full. It does not wait for a response
pub async fn send(&self, request: Req) -> Result<ResponseReceiver<Res>, SendError<Req>> {
let (response_sender, response_receiver) = oneshot::channel::<Res>();
let responder = Responder::new(response_sender);
Expand All @@ -72,7 +72,7 @@ impl<Req, Res> RequestSender<Req, Res> {

/// Send a request over the MPSC channel, wait for the response and return it
///
/// This call blocks if the request channel is full, and while waiting for the response
/// This call waits if the request channel is full, and while waiting for the response
pub async fn send_receive(&self, request: Req) -> Result<Res, RequestError<Req>> {
let mut receiver = self.send(request).await?;
receiver.recv().await.map_err(|err| err.into())
Expand Down
4 changes: 0 additions & 4 deletions src/unbounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ impl<Req, Res> UnboundedRequestSender<Req, Res> {

/// Send a request over the MPSC channel, open the response channel
/// Return the [`ResponseReceiver`] which can be used to wait for a response
///
/// This call blocks if the request channel is full. It does not wait for a response
pub fn send(&self, request: Req) -> Result<ResponseReceiver<Res>, SendError<Req>> {
let (response_sender, response_receiver) = oneshot::channel::<Res>();
let responder = UnboundedResponder::new(response_sender);
Expand All @@ -61,8 +59,6 @@ impl<Req, Res> UnboundedRequestSender<Req, Res> {
}

/// Send a request over the MPSC channel, wait for the response and return it
///
/// This call blocks if the request channel is full, and while waiting for the response
pub async fn send_receive(&self, request: Req) -> Result<Res, RequestError<Req>> {
let mut receiver = self.send(request)?;
receiver.recv().await.map_err(|err| err.into())
Expand Down

0 comments on commit bfe74a5

Please sign in to comment.