id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
#[should_panic] async fn blocking_recv_async() { let (_tx, mut rx) = mpsc::channel::<()>(1); let _ = rx.blocking_recv(); } #[test] fn blocking_send() { let (tx, mut rx) = mpsc::channel::<u8>(1); let sync_code = thread::spawn(move || { tx.blocking_send(10).unwrap(); }); Runtime::new()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
62023dffe5396ee1a0380f12c7530bf4ff59fe4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/62023dffe5396ee1a0380f12c7530bf4ff59fe4a/tokio/tests/sync_mpsc.rs
441
500
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:13
assert!(recv.is_woken()); let val = assert_ready!(recv.poll()); assert!(val.is_none()); } #[tokio::test] async fn permit_available_not_acquired_close() { let (tx1, mut rx) = mpsc::channel::<()>(1); let tx2 = tx1.clone(); let permit1 = assert_ok!(tx1.reserve().await); let mut permit2 = task::s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
62023dffe5396ee1a0380f12c7530bf4ff59fe4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/62023dffe5396ee1a0380f12c7530bf4ff59fe4a/tokio/tests/sync_mpsc.rs
481
504
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
#[should_panic] async fn blocking_recv_async() { let (_tx, mut rx) = mpsc::channel::<()>(1); let _ = rx.blocking_recv(); } #[test] fn blocking_send() { let (tx, mut rx) = mpsc::channel::<u8>(1); let sync_code = thread::spawn(move || { tx.blocking_send(10).unwrap(); }); Runtime::new()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/tests/sync_mpsc.rs
441
485
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::thread; use tokio::runtime::Runtime; use tokio::sync::mpsc; use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
let val = assert_ready!(rx.enter(|cx, mut rx| rx.poll_recv(cx))); assert!(val.is_none()); } #[test] fn disarm() { let (tx, rx) = mpsc::channel::<i32>(2); let mut tx1 = task::spawn(tx.clone()); let mut tx2 = task::spawn(tx.clone()); let mut tx3 = task::spawn(tx.clone()); let mut tx4 = task::spaw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:3
} #[tokio::test] async fn send_recv_stream_with_buffer() { use tokio::stream::StreamExt; let (mut tx, mut rx) = mpsc::channel::<i32>(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.next().await); assert_eq!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:4
assert_ok!(tx1.try_send(())); t1.enter(|cx, _| { assert_pending!(tx1.poll_ready(cx)); }); t2.enter(|cx, _| { assert_pending!(tx2.poll_ready(cx)); }); drop(tx1); let val = t3.enter(|cx, _| assert_ready!(rx.poll_recv(cx))); assert!(val.is_some()); assert!(t2.is_woken()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:5
let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(1)); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(2)); drop(tx); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert!(val.is_none()); } #[tokio::test] async ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:6
assert_eq!(None, rx.next().await); } #[test] fn no_t_bounds_buffer() { struct NoImpls; let mut t1 = task::spawn(()); let (tx, mut rx) = mpsc::channel(100); // sender should be Debug even though T isn't Debug println!("{:?}", tx); // same with Receiver println!("{:?}", rx); // and send...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:7
fn send_recv_buffer_limited() { let mut t1 = task::spawn(()); let mut t2 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(1); // Run on a task context t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); // Send first message assert_ok!(tx.try_send(1)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:8
assert_eq!(Some(2), val); }); t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); }); } #[test] fn recv_close_gets_none_idle() { let mut t1 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(10); rx.close(); t1.enter(|cx, _| { let val = assert_ready!(rx.p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
281
340
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:9
assert!(t2.is_woken()); t2.enter(|cx, _| { assert_ready_err!(tx2.poll_ready(cx)); }); t3.enter(|cx, _| assert_pending!(rx.poll_recv(cx))); assert!(!t1.is_woken()); assert!(!t2.is_woken()); assert_ok!(tx1.try_send(123)); assert!(t3.is_woken()); t3.enter(|cx, _| { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
321
380
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:10
let (mut tx, mut rx) = mpsc::channel(1); tx.try_send("hello").unwrap(); // This should fail match assert_err!(tx.try_send("fail")) { TrySendError::Full(..) => {} _ => panic!(), } let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some("hello")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
361
420
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:11
drop(tx1); assert!(t2.is_woken()); assert_ready_ok!(t2.enter(|cx, _| tx2.poll_ready(cx))); } #[test] fn dropping_rx_closes_channel() { let mut t1 = task::spawn(()); let (mut tx, rx) = mpsc::channel(100); let msg = Arc::new(()); assert_ok!(tx.try_send(msg.clone())); drop(rx); assert...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
401
460
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
} #[test] fn unconsumed_messages_are_dropped() { let msg = Arc::new(()); let (mut tx, rx) = mpsc::channel(100); tx.try_send(msg.clone()).unwrap(); assert_eq!(2, Arc::strong_count(&msg)); drop((tx, rx)); assert_eq!(1, Arc::strong_count(&msg)); } #[test] fn try_recv() { let (mut tx, mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
441
500
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:13
Err(TryRecvError::Empty) => {} _ => panic!(), } tx.send(42).unwrap(); match rx.try_recv() { Ok(42) => {} _ => panic!(), } drop(tx); match rx.try_recv() { Err(TryRecvError::Closed) => {} _ => panic!(), } } #[test] fn blocking_recv() { let (mut tx, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
481
540
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:14
let sync_code = thread::spawn(move || { tx.blocking_send(10).unwrap(); }); Runtime::new().unwrap().block_on(async move { assert_eq!(Some(10), rx.recv().await); }); sync_code.join().unwrap() } #[tokio::test] #[should_panic] async fn blocking_send_async() { let (mut tx, _rx) = mpsc::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
93f8cb8df2bb0dceb7921556165a8ed8efed9151
github
async-runtime
https://github.com/tokio-rs/tokio/blob/93f8cb8df2bb0dceb7921556165a8ed8efed9151/tokio/tests/sync_mpsc.rs
521
558
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:13
Err(TryRecvError::Empty) => {} _ => panic!(), } tx.send(42).unwrap(); match rx.try_recv() { Ok(42) => {} _ => panic!(), } drop(tx); match rx.try_recv() { Err(TryRecvError::Closed) => {} _ => panic!(), } } #[test] fn blocking_recv() { let (mut tx, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
347e18bc7700d0e93c5da494a49728d5b2cce500
github
async-runtime
https://github.com/tokio-rs/tokio/blob/347e18bc7700d0e93c5da494a49728d5b2cce500/tokio/tests/sync_mpsc.rs
481
536
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:14
let sync_code = thread::spawn(move || { tx.blocking_send(10).unwrap(); }); Runtime::new().unwrap().block_on(async move { assert_eq!(Some(10), rx.recv().await); }); sync_code.join().unwrap() } #[tokio::test] #[should_panic] async fn blocking_send_async() { let (mut tx, _rx) = mpsc::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
347e18bc7700d0e93c5da494a49728d5b2cce500
github
async-runtime
https://github.com/tokio-rs/tokio/blob/347e18bc7700d0e93c5da494a49728d5b2cce500/tokio/tests/sync_mpsc.rs
521
536
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::mpsc; use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::syn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
} #[test] fn disarm() { let (tx, rx) = mpsc::channel::<i32>(2); let mut tx1 = task::spawn(tx.clone()); let mut tx2 = task::spawn(tx.clone()); let mut tx3 = task::spawn(tx.clone()); let mut tx4 = task::spawn(tx); let mut rx = task::spawn(rx); // We should be able to `poll_ready` two handles...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:3
#[tokio::test] async fn send_recv_stream_with_buffer() { use tokio::stream::StreamExt; let (mut tx, mut rx) = mpsc::channel::<i32>(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.next().await); assert_eq!(So...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:4
t1.enter(|cx, _| { assert_pending!(tx1.poll_ready(cx)); }); t2.enter(|cx, _| { assert_pending!(tx2.poll_ready(cx)); }); drop(tx1); let val = t3.enter(|cx, _| assert_ready!(rx.poll_recv(cx))); assert!(val.is_some()); assert!(t2.is_woken()); assert!(!t1.is_woken()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:5
assert_eq!(val, Some(1)); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(2)); drop(tx); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert!(val.is_none()); } #[tokio::test] async fn async_send_recv_unbounded() { let (tx, mut rx) = mpsc::unb...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:6
#[test] fn no_t_bounds_buffer() { struct NoImpls; let mut t1 = task::spawn(()); let (tx, mut rx) = mpsc::channel(100); // sender should be Debug even though T isn't Debug println!("{:?}", tx); // same with Receiver println!("{:?}", rx); // and sender should be Clone even though T isn't...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:7
let mut t2 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(1); // Run on a task context t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); // Send first message assert_ok!(tx.try_send(1)); // Not ready assert_pending!(tx.poll_ready(cx)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:8
t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); }); } #[test] fn recv_close_gets_none_idle() { let mut t1 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(10); rx.close(); t1.enter(|cx, _| { let val = assert_ready!(rx.poll_recv(cx)); assert!(val.is_n...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
281
340
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:9
t2.enter(|cx, _| { assert_ready_err!(tx2.poll_ready(cx)); }); t3.enter(|cx, _| assert_pending!(rx.poll_recv(cx))); assert!(!t1.is_woken()); assert!(!t2.is_woken()); assert_ok!(tx1.try_send(123)); assert!(t3.is_woken()); t3.enter(|cx, _| { let v = assert_ready!(rx.poll_re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
321
380
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:10
tx.try_send("hello").unwrap(); // This should fail match assert_err!(tx.try_send("fail")) { TrySendError::Full(..) => {} _ => panic!(), } let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some("hello")); assert_ok!(tx.try_send("goodbye")); drop(t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
361
420
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:11
assert!(t2.is_woken()); assert_ready_ok!(t2.enter(|cx, _| tx2.poll_ready(cx))); } #[test] fn dropping_rx_closes_channel() { let mut t1 = task::spawn(()); let (mut tx, rx) = mpsc::channel(100); let msg = Arc::new(()); assert_ok!(tx.try_send(msg.clone())); drop(rx); assert_ready_err!(t1.e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
401
460
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
#[test] fn unconsumed_messages_are_dropped() { let msg = Arc::new(()); let (mut tx, rx) = mpsc::channel(100); tx.try_send(msg.clone()).unwrap(); assert_eq!(2, Arc::strong_count(&msg)); drop((tx, rx)); assert_eq!(1, Arc::strong_count(&msg)); } #[test] fn try_recv() { let (mut tx, mut rx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
441
492
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:13
} tx.send(42).unwrap(); match rx.try_recv() { Ok(42) => {} _ => panic!(), } drop(tx); match rx.try_recv() { Err(TryRecvError::Closed) => {} _ => panic!(), } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fb1698e8d8fa9d4ce295b63a17c461b3a40dddd/tokio/tests/sync_mpsc.rs
481
492
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::mpsc; use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::syn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:11
} #[test] fn unconsumed_messages_are_dropped() { let msg = Arc::new(()); let (mut tx, rx) = mpsc::channel(100); tx.try_send(msg.clone()).unwrap(); assert_eq!(2, Arc::strong_count(&msg)); drop((tx, rx)); assert_eq!(1, Arc::strong_count(&msg)); } #[test] fn try_recv() { let (mut tx, mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_mpsc.rs
401
454
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
Err(TryRecvError::Empty) => {} _ => panic!(), } tx.send(42).unwrap(); match rx.try_recv() { Ok(42) => {} _ => panic!(), } drop(tx); match rx.try_recv() { Err(TryRecvError::Closed) => {} _ => panic!(), } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_mpsc.rs
441
454
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::mpsc; use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::syn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
} #[tokio::test] async fn send_recv_stream_with_buffer() { use futures::StreamExt; let (mut tx, mut rx) = mpsc::channel::<i32>(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.next().await); assert_eq!(Some(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:4
let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(1)); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(2)); drop(tx); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert!(val.is_none()); } #[tokio::test] async ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_mpsc.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::mpsc; use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; trait AssertSend: Send {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
#[tokio::test] async fn send_recv_stream_with_buffer() { use futures::StreamExt; let (mut tx, mut rx) = mpsc::channel::<i32>(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.next().await); assert_eq!(Some(2),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:3
assert_ok!(tx1.try_send(())); t1.enter(|cx, _| { assert_pending!(tx1.poll_ready(cx)); }); t2.enter(|cx, _| { assert_pending!(tx2.poll_ready(cx)); }); drop(tx1); let val = t3.enter(|cx, _| assert_ready!(rx.poll_recv(cx))); assert!(val.is_some()); assert!(t2.is_woken()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:5
} #[test] fn no_t_bounds_buffer() { struct NoImpls; let mut t1 = task::spawn(()); let (tx, mut rx) = mpsc::channel(100); // sender should be Debug even though T isn't Debug println!("{:?}", tx); // same with Receiver println!("{:?}", rx); // and sender should be Clone even though T is...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:6
let mut t1 = task::spawn(()); let mut t2 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(1); // Run on a task context t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); // Send first message assert_ok!(tx.try_send(1)); // Not ready assert_p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:7
}); t1.enter(|cx, _| { assert_ready_ok!(tx.poll_ready(cx)); }); } #[test] fn recv_close_gets_none_idle() { let mut t1 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(10); rx.close(); t1.enter(|cx, _| { let val = assert_ready!(rx.poll_recv(cx)); assert!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:8
t2.enter(|cx, _| { assert_ready_err!(tx2.poll_ready(cx)); }); t3.enter(|cx, _| assert_pending!(rx.poll_recv(cx))); assert!(!t1.is_woken()); assert!(!t2.is_woken()); assert_ok!(tx1.try_send(123)); assert!(t3.is_woken()); t3.enter(|cx, _| { let v = assert_ready!(rx.poll_re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
281
340
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:9
let (mut tx, mut rx) = mpsc::channel(1); tx.try_send("hello").unwrap(); // This should fail match assert_err!(tx.try_send("fail")) { TrySendError::Full(..) => {} _ => panic!(), } let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some("hello")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
321
380
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:10
assert!(t2.is_woken()); assert_ready_ok!(t2.enter(|cx, _| tx2.poll_ready(cx))); } #[test] fn dropping_rx_closes_channel() { let mut t1 = task::spawn(()); let (mut tx, rx) = mpsc::channel(100); let msg = Arc::new(()); assert_ok!(tx.try_send(msg.clone())); drop(rx); assert_ready_err!(t1.e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
361
420
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:12
_ => panic!(), } tx.send(42).unwrap(); match rx.try_recv() { Ok(42) => {} _ => panic!(), } drop(tx); match rx.try_recv() { Err(TryRecvError::Closed) => {} _ => panic!(), } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mpsc.rs
441
453
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::mpsc; use tokio::sync::mpsc::error::TrySendError; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; trait AssertSend: Send {} impl AssertSend ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:10
assert!(t2.is_woken()); assert_ready_ok!(t2.enter(|cx, _| tx2.poll_ready(cx))); } #[test] fn dropping_rx_closes_channel() { let mut t1 = task::spawn(()); let (mut tx, rx) = mpsc::channel(100); let msg = Arc::new(()); assert_ok!(tx.try_send(msg.clone())); drop(rx); assert_ready_err!(t1.e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_mpsc.rs
361
415
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:11
#[test] fn unconsumed_messages_are_dropped() { let msg = Arc::new(()); let (mut tx, rx) = mpsc::channel(100); tx.try_send(msg.clone()).unwrap(); assert_eq!(2, Arc::strong_count(&msg)); drop((tx, rx)); assert_eq!(1, Arc::strong_count(&msg)); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_mpsc.rs
401
415
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::mpsc; use tokio::sync::mpsc::error::TrySendError; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; trait AssertSend: Send {} impl AssertSend for mpsc::Sender<i32> {} i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
#[tokio::test] async fn send_recv_stream_with_buffer() { use futures::StreamExt; let (mut tx, mut rx) = mpsc::channel::<i32>(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.next().await); assert_eq!(Some(2),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:4
assert_eq!(val, Some(1)); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(2)); drop(tx); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert!(val.is_none()); } #[tokio::test] async fn async_send_recv_unbounded() { let (tx, mut rx) = mpsc::unb...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_mpsc.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::mpsc; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; trait AssertSend: Send {} impl AssertSend for mpsc::Sender<i32> {} impl AssertSend for mpsc::Receiver<i32> {} #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:2
async fn async_send_recv_with_buffer() { let (mut tx, mut rx) = mpsc::channel(16); tokio::spawn(async move { assert_ok!(tx.send(1).await); assert_ok!(tx.send(2).await); }); assert_eq!(Some(1), rx.recv().await); assert_eq!(Some(2), rx.recv().await); assert_eq!(None, rx.recv().aw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:3
}); } #[test] fn start_send_past_cap() { let mut t1 = task::spawn(()); let mut t2 = task::spawn(()); let mut t3 = task::spawn(()); let (mut tx1, mut rx) = mpsc::channel(1); let mut tx2 = tx1.clone(); assert_ok!(tx1.try_send(())); t1.enter(|cx, _| { assert_pending!(tx1.poll_ready(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:4
} #[test] fn send_recv_unbounded() { let mut t1 = task::spawn(()); let (mut tx, mut rx) = mpsc::unbounded_channel::<i32>(); // Using `try_send` assert_ok!(tx.try_send(1)); assert_ok!(tx.try_send(2)); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some(1)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:5
use futures_core::Stream; use futures_sink::Sink; use futures_util::pin_mut; let mut t1 = task::spawn(()); let (tx, rx) = mpsc::unbounded_channel::<i32>(); t1.enter(|cx, _| { pin_mut!(tx); assert_ready_ok!(tx.as_mut().poll_ready(cx)); assert_ok!(tx.as_mut().start_send(1))...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:6
let (tx, mut rx) = mpsc::channel(100); // sender should be Debug even though T isn't Debug println!("{:?}", tx); // same with Receiver println!("{:?}", rx); // and sender should be Clone even though T isn't Clone assert!(tx.clone().try_send(NoImpls).is_ok()); let val = assert_ready!(t1.ent...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:7
assert_ready_ok!(tx.poll_ready(cx)); // Send first message assert_ok!(tx.try_send(1)); // Not ready assert_pending!(tx.poll_ready(cx)); // Send second message assert_err!(tx.try_send(1337)); }); t2.enter(|cx, _| { // Take the value let val = as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:8
#[test] fn recv_close_gets_none_idle() { let mut t1 = task::spawn(()); let (mut tx, mut rx) = mpsc::channel::<i32>(10); rx.close(); t1.enter(|cx, _| { let val = assert_ready!(rx.poll_recv(cx)); assert!(val.is_none()); assert_ready_err!(tx.poll_ready(cx)); }); } #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
281
340
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:9
assert!(!t1.is_woken()); assert!(!t2.is_woken()); assert_ok!(tx1.try_send(123)); assert!(t3.is_woken()); t3.enter(|cx, _| { let v = assert_ready!(rx.poll_recv(cx)); assert_eq!(v, Some(123)); let v = assert_ready!(rx.poll_recv(cx)); assert!(v.is_none()); }); } #[t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
321
380
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:10
let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some("hello")); assert_ok!(tx.try_send("goodbye")); drop(tx); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx))); assert_eq!(val, Some("goodbye")); let val = assert_ready!(t1.enter(|cx, _| rx.poll_recv(cx)))...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
361
420
tokio-rs/tokio:tokio/tests/sync_mpsc.rs:11
let (mut tx, rx) = mpsc::channel(100); let msg = Arc::new(()); assert_ok!(tx.try_send(msg.clone())); drop(rx); assert_ready_err!(t1.enter(|cx, _| tx.poll_ready(cx))); assert_eq!(1, Arc::strong_count(&msg)); } #[test] fn dropping_rx_closes_channel_for_try() { let (mut tx, rx) = mpsc::channel(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_mpsc.rs
401
443
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::{Acquire, Release}; use tokio::sync::mpsc::{self, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:2
Some(msg) => { if i == 10 { assert_eq!(msg, 20); } } None => { assert_eq!(i, 11); break; } } } let tx_weak = tx_weak.unwrap(); let upgraded = tx_weak.upgrade(); assert!(upgrad...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:3
received_self_msg: false, } } fn handle_message(&mut self, msg: ActorMessage) { match msg { ActorMessage::GetUniqueId { respond_to } => { self.next_id += 1; // The `let _ =` ignores any errors when sending. ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:4
} i += 1 } assert!(self.received_self_msg); } } #[derive(Clone)] pub struct MyActorHandle { sender: mpsc::Sender<ActorMessage>, } impl MyActorHandle { pub fn new() -> (Self, MyActor) { let (sender, receiver) = mpsc::chan...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
121
180
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:5
drop(handle); }) .await; let _ = actor_handle.await; } static NUM_DROPPED: AtomicUsize = AtomicUsize::new(0); #[derive(Debug)] struct Msg; impl Drop for Msg { fn drop(&mut self) { NUM_DROPPED.fetch_add(1, Release); } } // Tests that no pending messages are put onto the channel after `Rx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:6
drop(rx); assert_eq!(NUM_DROPPED.load(Acquire), 3); // This msg will not be put onto `Tx` list anymore, since `Rx` is closed. assert!(tx.send(Msg {}).await.is_err()); assert_eq!(NUM_DROPPED.load(Acquire), 4); } // Tests that a `WeakSender` is upgradeable when other `Sender`s exist. #[test] fn downgr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:7
// Tests that we can upgrade a weak sender with an outstanding permit // but no other strong senders. #[tokio::test] async fn downgrade_get_permit_upgrade_no_senders() { let (tx, _rx) = mpsc::channel::<i32>(1); let weak_tx = tx.downgrade(); let _permit = tx.reserve_owned().await.unwrap(); assert!(weak_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:8
for i in 0..10 { if tx.send(i).is_err() { return None; } } let tx2 = tx_weak .upgrade() .expect("expected to be able to upgrade tx_weak"); let _ = tx2.send(20); let tx_weak = tx2.downgrade(); Some(tx_weak) }) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
281
340
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:9
pub struct MyActor { receiver: mpsc::UnboundedReceiver<ActorMessage>, sender: mpsc::WeakUnboundedSender<ActorMessage>, next_id: u32, pub received_self_msg: bool, } enum ActorMessage { GetUniqueId { respond_to: oneshot::Sender<u32> }, SelfMessage {}, } im...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
321
380
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:10
} async fn send_message_to_self(&mut self) { let msg = ActorMessage::SelfMessage {}; let sender = self.sender.clone(); // cannot move self.sender here if let Some(sender) = sender.upgrade() { let _ = sender.send(msg); self.sender...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
361
420
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:11
(Self { sender }, actor) } pub async fn get_unique_id(&self) -> u32 { let (send, recv) = oneshot::channel(); let msg = ActorMessage::GetUniqueId { respond_to: send }; // Ignore send errors. If this send fails, so does the // recv.await below. There's no ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
401
460
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:12
// dropped. // // Note: After the introduction of `UnboundedWeakSender`, which internally // used `Arc` and doesn't call a drop of the channel after the last strong // `UnboundedSender` was dropped while more than one `UnboundedWeakSender` // remains, we want to ensure that no messages are kept in the channel, which //...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
441
500
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:13
// Tests that a `WeakUnboundedSender` fails to upgrade when no other // `UnboundedSender` exists. #[test] fn downgrade_upgrade_unbounded_sender_failure() { let (tx, _rx) = mpsc::unbounded_channel::<i32>(); let weak_tx = tx.downgrade(); drop(tx); assert!(weak_tx.upgrade().is_none()); } // Tests that an ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
481
540
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:14
assert!(rx.is_closed()); } #[tokio::test] async fn test_rx_unbounded_is_closed_when_dropping_all_senders_except_weak_senders() { // is_closed should return true after dropping all senders except for a weak sender let (tx, rx) = mpsc::unbounded_channel::<()>(); let _weak_sender = tx.clone().downgrade(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
521
580
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:15
assert_eq!(tx.strong_count(), 1); assert_eq!(rx.sender_strong_count(), 1); } #[tokio::test] async fn sender_weak_count_when_dropped() { let (tx, rx) = mpsc::channel::<()>(1); let weak = tx.downgrade(); drop(weak); assert_eq!(tx.weak_count(), 0); assert_eq!(rx.sender_weak_count(), 0); } #[to...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
561
620
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:16
assert_eq!(tx.strong_count(), 1); assert_eq!(weak.strong_count(), 1); assert_eq!(rx.sender_strong_count(), 1); assert_eq!(tx.weak_count(), 1); assert_eq!(weak.weak_count(), 1); assert_eq!(rx.sender_weak_count(), 1); } #[tokio::test] async fn unbounded_sender_strong_count_when_cloned() { let (t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
601
660
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:17
assert_eq!(tx.strong_count(), 1); assert_eq!(rx.sender_strong_count(), 1); } #[tokio::test] async fn unbounded_sender_weak_count_when_dropped() { let (tx, rx) = mpsc::unbounded_channel::<()>(); let weak = tx.downgrade(); drop(weak); assert_eq!(tx.weak_count(), 0); assert_eq!(rx.sender_weak_c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mpsc_weak.rs
641
688
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:13
// Tests that a `WeakUnboundedSender` fails to upgrade when no other // `UnboundedSender` exists. #[test] fn downgrade_upgrade_unbounded_sender_failure() { let (tx, _rx) = mpsc::unbounded_channel::<i32>(); let weak_tx = tx.downgrade(); drop(tx); assert!(weak_tx.upgrade().is_none()); } // Tests that an ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
3ce4720a4532e40c78f7d851b1cfb8ea26542177
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/tests/sync_mpsc_weak.rs
481
540
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:14
assert!(rx.is_closed()); } #[tokio::test] async fn test_rx_unbounded_is_closed_when_dropping_all_senders_except_weak_senders() { // is_closed should return true after dropping all senders except for a weak sender let (tx, rx) = mpsc::unbounded_channel::<()>(); let _weak_sender = tx.clone().downgrade(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
3ce4720a4532e40c78f7d851b1cfb8ea26542177
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/tests/sync_mpsc_weak.rs
521
580
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:15
assert_eq!(tx.strong_count(), 1); } #[tokio::test] async fn sender_weak_count_when_dropped() { let (tx, _rx) = mpsc::channel::<()>(1); let weak = tx.downgrade(); drop(weak); assert_eq!(tx.weak_count(), 0); } #[tokio::test] async fn sender_strong_and_weak_conut() { let (tx, _rx) = mpsc::channel:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
3ce4720a4532e40c78f7d851b1cfb8ea26542177
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/tests/sync_mpsc_weak.rs
561
620
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:16
assert_eq!(weak.weak_count(), 1); } #[tokio::test] async fn unbounded_sender_strong_count_when_cloned() { let (tx, _rx) = mpsc::unbounded_channel::<()>(); let tx2 = tx.clone(); assert_eq!(tx.strong_count(), 2); assert_eq!(tx2.strong_count(), 2); } #[tokio::test] async fn unbounded_sender_weak_count_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
3ce4720a4532e40c78f7d851b1cfb8ea26542177
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/tests/sync_mpsc_weak.rs
601
660
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:17
drop(weak); assert_eq!(tx.weak_count(), 0); } #[tokio::test] async fn unbounded_sender_strong_and_weak_conut() { let (tx, _rx) = mpsc::unbounded_channel::<()>(); let tx2 = tx.clone(); let weak = tx.downgrade(); let weak2 = tx2.downgrade(); assert_eq!(tx.strong_count(), 2); assert_eq!(tx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
3ce4720a4532e40c78f7d851b1cfb8ea26542177
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/tests/sync_mpsc_weak.rs
641
673
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:13
// Tests that a `WeakUnboundedSender` fails to upgrade when no other // `UnboundedSender` exists. #[test] fn downgrade_upgrade_unbounded_sender_failure() { let (tx, _rx) = mpsc::unbounded_channel::<i32>(); let weak_tx = tx.downgrade(); drop(tx); assert!(weak_tx.upgrade().is_none()); } // Tests that an ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
1846483f1953f6ac4dd89f434e78ff99eb0c92f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1846483f1953f6ac4dd89f434e78ff99eb0c92f9/tokio/tests/sync_mpsc_weak.rs
481
540
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:14
assert_eq!(tx.strong_count(), 2); assert_eq!(tx2.strong_count(), 2); } #[tokio::test] async fn sender_weak_count_when_downgraded() { let (tx, _rx) = mpsc::channel::<()>(1); let weak = tx.downgrade(); assert_eq!(tx.weak_count(), 1); assert_eq!(weak.weak_count(), 1); } #[tokio::test] async fn send...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
1846483f1953f6ac4dd89f434e78ff99eb0c92f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1846483f1953f6ac4dd89f434e78ff99eb0c92f9/tokio/tests/sync_mpsc_weak.rs
521
580
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:15
let tx2 = tx.clone(); let weak = tx.downgrade(); let weak2 = tx2.downgrade(); assert_eq!(tx.strong_count(), 2); assert_eq!(tx2.strong_count(), 2); assert_eq!(weak.strong_count(), 2); assert_eq!(weak2.strong_count(), 2); assert_eq!(tx.weak_count(), 2); assert_eq!(tx2.weak_count(), 2); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
1846483f1953f6ac4dd89f434e78ff99eb0c92f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1846483f1953f6ac4dd89f434e78ff99eb0c92f9/tokio/tests/sync_mpsc_weak.rs
561
620
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:16
assert_eq!(tx.weak_count(), 1); assert_eq!(weak.weak_count(), 1); } #[tokio::test] async fn unbounded_sender_strong_count_when_dropped() { let (tx, _rx) = mpsc::unbounded_channel::<()>(); let tx2 = tx.clone(); drop(tx2); assert_eq!(tx.strong_count(), 1); } #[tokio::test] async fn unbounded_send...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
1846483f1953f6ac4dd89f434e78ff99eb0c92f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1846483f1953f6ac4dd89f434e78ff99eb0c92f9/tokio/tests/sync_mpsc_weak.rs
601
655
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:17
assert_eq!(tx.weak_count(), 2); assert_eq!(tx2.weak_count(), 2); assert_eq!(weak.weak_count(), 2); assert_eq!(weak2.weak_count(), 2); drop(tx2); drop(weak2); assert_eq!(tx.strong_count(), 1); assert_eq!(weak.strong_count(), 1); assert_eq!(tx.weak_count(), 1); assert_eq!(weak.weak_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
1846483f1953f6ac4dd89f434e78ff99eb0c92f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1846483f1953f6ac4dd89f434e78ff99eb0c92f9/tokio/tests/sync_mpsc_weak.rs
641
655
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:13
// Tests that a `WeakUnboundedSender` fails to upgrade when no other // `UnboundedSender` exists. #[test] fn downgrade_upgrade_unbounded_sender_failure() { let (tx, _rx) = mpsc::unbounded_channel::<i32>(); let weak_tx = tx.downgrade(); drop(tx); assert!(weak_tx.upgrade().is_none()); } // Tests that an ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mpsc_weak.rs
481
513
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:1
#![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::{Acquire, Release}; use tokio::sync::mpsc::{self, channel, unbounded_channel}; use ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
01f019397182097c955bae5358034bb9763ba964
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01f019397182097c955bae5358034bb9763ba964/tokio/tests/sync_mpsc_weak.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:5
drop(handle); }) .await; let _ = actor_handle.await; } static NUM_DROPPED: AtomicUsize = AtomicUsize::new(0); #[derive(Debug)] struct Msg; impl Drop for Msg { fn drop(&mut self) { NUM_DROPPED.fetch_add(1, Release); } } // Tests that no pending messages are put onto the channel after `Rx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
582d51290772491aa01b2efbbc86d4bdc5fabe21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/582d51290772491aa01b2efbbc86d4bdc5fabe21/tokio/tests/sync_mpsc_weak.rs
161
220
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:6
drop(rx); assert_eq!(NUM_DROPPED.load(Acquire), 3); // This msg will not be put onto `Tx` list anymore, since `Rx` is closed. assert!(tx.send(Msg {}).await.is_err()); assert_eq!(NUM_DROPPED.load(Acquire), 4); } // Tests that a `WeakSender` is upgradeable when other `Sender`s exist. #[tokio::test] as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
582d51290772491aa01b2efbbc86d4bdc5fabe21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/582d51290772491aa01b2efbbc86d4bdc5fabe21/tokio/tests/sync_mpsc_weak.rs
201
260
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:7
// Tests that we can upgrade a weak sender with an outstanding permit // but no other strong senders. #[tokio::test] async fn downgrade_get_permit_upgrade_no_senders() { let (tx, _rx) = mpsc::channel::<i32>(1); let weak_tx = tx.downgrade(); let _permit = tx.reserve_owned().await.unwrap(); assert!(weak_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
582d51290772491aa01b2efbbc86d4bdc5fabe21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/582d51290772491aa01b2efbbc86d4bdc5fabe21/tokio/tests/sync_mpsc_weak.rs
241
300
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:12
// dropped. // // Note: After the introduction of `UnboundedWeakSender`, which internally // used `Arc` and doesn't call a drop of the channel after the last strong // `UnboundedSender` was dropped while more than one `UnboundedWeakSender` // remains, we want to ensure that no messages are kept in the channel, which //...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
582d51290772491aa01b2efbbc86d4bdc5fabe21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/582d51290772491aa01b2efbbc86d4bdc5fabe21/tokio/tests/sync_mpsc_weak.rs
441
500
tokio-rs/tokio:tokio/tests/sync_mpsc_weak.rs:13
// Tests that a `WeakUnboundedSender` fails to upgrade when no other // `UnboundedSender` exists. #[tokio::test] async fn downgrade_upgrade_unbounded_sender_failure() { let (tx, _rx) = mpsc::unbounded_channel::<i32>(); let weak_tx = tx.downgrade(); drop(tx); assert!(weak_tx.upgrade().is_none()); } // T...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mpsc_weak.rs
MIT
582d51290772491aa01b2efbbc86d4bdc5fabe21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/582d51290772491aa01b2efbbc86d4bdc5fabe21/tokio/tests/sync_mpsc_weak.rs
481
513
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_family = "...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex.rs
1
60