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/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use std::io;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
use tokio::net::{UnixListener, UnixStream};
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
use futures::future::{poll_fn, try_join};
#[tok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | b877629cb1678132611211b43b4b9e1b879e6b20 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b877629cb1678132611211b43b4b9e1b879e6b20/tokio/tests/uds_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:10 | }
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Interest::READABLE).await?;
if ready.is_read_closed() {
break;
} else {
tokio::task::yield_now().await;
}
}
O... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 0b93bd511da6e96eaa9237760dc9683710ebdabc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0b93bd511da6e96eaa9237760dc9683710ebdabc/tokio/tests/uds_stream.rs | 361 | 381 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:2 | #[tokio::test]
async fn shutdown() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("tokio-uds-tests")
.tempdir()
.unwrap();
let sock_path = dir.path().join("connect.sock");
let listener = UnixListener::bind(&sock_path)?;
let accept = listener.accept();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:3 | let mut readable = task::spawn(server.readable());
assert_pending!(readable.poll());
// Write data.
client.writable().await?;
assert_eq!(msg.len(), client.try_write(msg)?);
// The task should be notified
while !readable.is_woken() {
tokio::task::yield_now().await;
}
// Fill th... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:4 | Ok(n) => i += n,
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => continue,
Err(e) => panic!("error = {:?}", e),
}
}
assert_eq!(read, written);
}
// Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Inte... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:5 | assert_ok!(poll_fn(|cx| $stream.poll_read_ready(cx)).await);
};
}
macro_rules! assert_not_readable_by_polling {
($stream:expr) => {
poll_fn(|cx| {
assert_pending!($stream.poll_read_ready(cx));
Poll::Ready(())
})
.await;
};
}
macro_rules! assert_writable_by_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:6 | // Readable until calls to `poll_read` return `Poll::Pending`.
let mut buf = [0u8; 4];
assert_ok!(server.read_exact(&mut buf).await);
assert_readable_by_polling!(server);
read_until_pending(&mut server);
assert_not_readable_by_polling!(server);
// Detect the client disconnect.
drop(client);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:7 | }
fn write_until_pending(stream: &mut UnixStream) {
let buf = vec![0u8; 1024 * 1024];
loop {
match stream.try_write(&buf) {
Ok(_) => (),
Err(err) => {
assert_eq!(err.kind(), io::ErrorKind::WouldBlock);
break;
}
}
}
}
#[tok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:8 | while !readable.is_woken() {
tokio::task::yield_now().await;
}
// Fill the write buffer
loop {
// Still ready
let mut writable = task::spawn(client.writable());
assert_ready_ok!(writable.poll());
match client.try_write(msg) {
Ok(n) => written.extend(&msg... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 281 | 336 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:9 | // Now, we listen for shutdown
drop(client);
loop {
let ready = server.ready(Interest::READABLE).await?;
if ready.is_read_closed() {
break;
} else {
tokio::task::yield_now().await;
}
}
Ok(())
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 3b6bee822dfe70caea7eb22b51fefb28d162f966 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b6bee822dfe70caea7eb22b51fefb28d162f966/tokio/tests/uds_stream.rs | 321 | 336 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:6 | // Readable until calls to `poll_read` return `Poll::Pending`.
let mut buf = [0u8; 4];
assert_ok!(server.read_exact(&mut buf).await);
assert_readable_by_polling!(server);
read_until_pending(&mut server);
assert_not_readable_by_polling!(server);
// Detect the client disconnect.
drop(client);... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 4c5541945348c4614c29a13c06f2e996eb419e42 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c5541945348c4614c29a13c06f2e996eb419e42/tokio/tests/uds_stream.rs | 201 | 254 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:7 | }
fn write_until_pending(stream: &mut UnixStream) {
let buf = vec![0u8; 1024 * 1024];
loop {
match stream.try_write(&buf) {
Ok(_) => (),
Err(err) => {
assert_eq!(err.kind(), io::ErrorKind::WouldBlock);
break;
}
}
}
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 4c5541945348c4614c29a13c06f2e996eb419e42 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c5541945348c4614c29a13c06f2e996eb419e42/tokio/tests/uds_stream.rs | 241 | 254 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{UnixListener, UnixStream};
use futures::future::try_join;
#[tokio::test]
async fn accept_read_write() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("toki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | ee597347c5e612611142ece09c79e55f2d243590 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ee597347c5e612611142ece09c79e55f2d243590/tokio/tests/uds_stream.rs | 1 | 58 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{UnixListener, UnixStream};
use futures::future::try_join;
#[tokio::test]
async fn accept_read_write() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("toki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | fc65951731506ba4bbbc08eed256b5e8b0d46655 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc65951731506ba4bbbc08eed256b5e8b0d46655/tokio/tests/uds_stream.rs | 1 | 58 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{UnixListener, UnixStream};
use futures::future::try_join;
#[tokio::test]
async fn accept_read_write() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("toki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 4ddc4371709562d2bd1d0373f0555f7c31926e53 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4ddc4371709562d2bd1d0373f0555f7c31926e53/tokio/tests/uds_stream.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/uds_stream.rs:1 | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::unix::*;
use futures::future::try_join;
#[tokio::test]
async fn accept_read_write() -> std::io::Result<()> {
let dir = tempfile::Builder::new()
.prefix("tokio-uds-tests")
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/uds_stream.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/uds_stream.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/unwindsafe.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn notify_is_unwind_safe() {
is_unwind_safe::<tokio::sync::Notify>();
}
#[test]
fn join_handle_is_unwind_safe() {
is_unwind_safe::<to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/unwindsafe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/unwindsafe.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/unwindsafe.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support panic recovery
use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn notify_is_unwind_safe() {
is_unwind_safe::<tokio::sync::Notify>();
}
#[test]
fn join_handle_is_unwind_safe() {
is_unwind_safe::<tokio::tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/unwindsafe.rs | MIT | 203a079743629db4685d6903d11089143f035f7b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/203a079743629db4685d6903d11089143f035f7b/tokio/tests/unwindsafe.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/unwindsafe.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support panic recovery
use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn join_handle_is_unwind_safe() {
is_unwind_safe::<tokio::task::JoinHandle<()>>();
}
#[test]
fn net_types_are_unwind_safe() {
is_unwind_safe:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/unwindsafe.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/unwindsafe.rs | 1 | 37 |
tokio-rs/tokio:tokio/tests/unwindsafe.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn join_handle_is_unwind_safe() {
is_unwind_safe::<tokio::task::JoinHandle<()>>();
}
#[test]
fn net_types_are_unwind_safe() {
is_unwi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/unwindsafe.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/unwindsafe.rs | 1 | 37 |
tokio-rs/tokio:ui-tests/src/lib.rs:1 | #[cfg(feature = "tokio-executor")]
pub use tokio_executor;
#[cfg(feature = "tokio-net")]
pub use tokio_net;
#[cfg(feature = "tokio")]
pub use tokio; | rust | rust | rust-source | tokio-rs/tokio | ui-tests/src/lib.rs | MIT | 4788d3a9e3dd037424442c98e9f26b93a33a2077 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4788d3a9e3dd037424442c98e9f26b93a33a2077/ui-tests/src/lib.rs | 1 | 8 |
tokio-rs/tokio:ui-tests/src/lib.rs:1 | #[cfg(feature = "tokio-executor")]
pub use tokio_executor;
#[cfg(feature = "tokio")]
pub use tokio; | rust | rust | rust-source | tokio-rs/tokio | ui-tests/src/lib.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/ui-tests/src/lib.rs | 1 | 5 |
tokio-rs/tokio:ui-tests/tests/features.rs:1 | #![allow(unused_imports)]
#[test]
#[cfg(feature = "tokio-net")]
fn net_default() {
use ui_tests::tokio_net::driver::{set_default, Handle, Reactor, Registration};
use ui_tests::tokio_net::util::PollEvented;
}
#[test]
#[cfg(feature = "net-with-tcp")]
fn net_with_tcp() {
use ui_tests::tokio_net::tcp;
}
#[te... | rust | rust | testsuite | tokio-rs/tokio | ui-tests/tests/features.rs | MIT | ce7e60e3965283328909aaef57c57e538526a880 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce7e60e3965283328909aaef57c57e538526a880/ui-tests/tests/features.rs | 1 | 45 |
tokio-rs/tokio:ui-tests/tests/features.rs:1 | #![allow(unused_imports)]
#[test]
#[cfg(feature = "tokio-net")]
fn net_default() {
use ui_tests::tokio_net::driver::{set_default, Handle, Reactor, Registration};
use ui_tests::tokio_net::util::PollEvented;
}
#[test]
#[cfg(feature = "net-with-tcp")]
fn net_with_tcp() {
use ui_tests::tokio_net::tcp;
}
#[te... | rust | rust | testsuite | tokio-rs/tokio | ui-tests/tests/features.rs | MIT | 4788d3a9e3dd037424442c98e9f26b93a33a2077 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4788d3a9e3dd037424442c98e9f26b93a33a2077/ui-tests/tests/features.rs | 1 | 36 |
tokio-rs/tokio:ui-tests/tests/features.rs:1 | #[test]
#[cfg(feature = "tokio-with-net")]
#[allow(unused_imports)]
fn tokio_with_net() {
// net is present
use ui_tests::tokio::net;
}
#[test]
fn compile_fail() {
let t = trybuild::TestCases::new();
#[cfg(feature = "executor-without-current-thread")]
t.compile_fail("tests/ui/executor_without_curre... | rust | rust | testsuite | tokio-rs/tokio | ui-tests/tests/features.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/ui-tests/tests/features.rs | 1 | 19 |
tokio-rs/tokio:ui-tests/tests/features.rs:1 | #[test]
#[cfg(feature = "tokio-with-net")]
#[allow(unused_imports)]
fn tokio_with_net() {
// Reactor is present
use ui_tests::tokio::reactor;
// net is present
use ui_tests::tokio::net;
}
#[test]
fn compile_fail() {
let t = trybuild::TestCases::new();
#[cfg(feature = "executor-without-current-... | rust | rust | testsuite | tokio-rs/tokio | ui-tests/tests/features.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/ui-tests/tests/features.rs | 1 | 22 |
tokio-rs/tokio:ui-tests/tests/features.rs:1 | #[test]
fn features() {
let t = trybuild::TestCases::new();
#[cfg(feature = "executor-without-current-thread")]
t.compile_fail("tests/ui/executor_without_current_thread.rs");
drop(t);
} | rust | rust | testsuite | tokio-rs/tokio | ui-tests/tests/features.rs | MIT | 9de7083be89bde2e26ee5bc4f3333f5c8d13762d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9de7083be89bde2e26ee5bc4f3333f5c8d13762d/ui-tests/tests/features.rs | 1 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.