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/macros_try_join.rs:3 | fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_val(&fut), 16);
let fut = async {
let ready1 = future::ready(ok(0i32));
let ready2 = future::ready(ok(0i... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_try_join.rs | 81 | 101 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | use tokio::sync::oneshot;
use tokio_test::{assert_pending, assert_ready, task};
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::try_join!(async { ok(1) },);
assert_eq!(foo, Ok((1,)));
}
#[tokio::test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::try_join!(async { ok(1) })... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:2 | tx2.send(123).unwrap();
assert!(join.is_woken());
assert_pending!(join.poll());
tx1.send("hello").unwrap();
assert!(join.is_woken());
let res: Result<(&str, u32), _> = assert_ready!(join.poll());
assert_eq!(Ok(("hello", 123)), res);
}
#[tokio::test]
async fn err_abort_early() {
let (tx1, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_val(&fut), 16);
let fut = async {
let ready1 = future::ready(ok(0i32));
let ready2 = future::ready(ok(0i32));
tokio::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf/tokio/tests/macros_try_join.rs | 81 | 100 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(all(windows))]
use std::io;
use std::mem;
use std::os::windows::io::AsRawHandle;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use winapi::shared::winerror;
#[tokio::test]
async fn... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:3 | // The first server needs to be constructed early so that clients can
// be correctly connected. Otherwise calling .wait will cause the client to
// error.
let mut server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for cl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:4 | match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break client,
Err(e) if e.raw_os_error() == Some(winerror::ERROR_PIPE_BUSY as i32) => (),
Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:6 | return Err(e);
}
}
}
};
{
let write_buf = b"pong\n";
let mut write_buf_cursor = 0;
loop {
server.writable().await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:7 | for _ in 0..N {
clients.push(tokio::spawn(async move {
// This showcases a generic connect loop.
//
// We immediately try to create a client, if it's not found or the
// pipe is busy we use the specialized wait function on the client
// builder.
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:9 | for client in clients {
let result = client.await?;
assert_eq!(result?, "pong\n");
}
server.await??;
Ok(())
}
// This tests what happens when a client tries to disconnect.
#[tokio::test]
async fn test_named_pipe_mode_message() -> io::Result<()> {
const PIPE_NAME: &str = r"\\.\pipe\test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:10 | std::ptr::null_mut(),
None,
std::ptr::null_mut(),
&mut io_status_block,
&mut file_directory_information as *mut _ as *mut _,
1024,
ntioapi::FileDirectoryInformation,
0,
&mut name,
0,
)
};
if stat... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/named_pipe.rs | 361 | 393 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:3 | // The first server needs to be constructed early so that clients can
// be correctly connected. Otherwise calling .wait will cause the client to
// error.
let mut server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for cl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 57c90c9750d02c5bca93a939c7d44d7fe74fe464 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57c90c9750d02c5bca93a939c7d44d7fe74fe464/tokio/tests/named_pipe.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:4 | match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break client,
Err(e) if e.raw_os_error() == Some(winerror::ERROR_PIPE_BUSY as i32) => (),
Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 57c90c9750d02c5bca93a939c7d44d7fe74fe464 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57c90c9750d02c5bca93a939c7d44d7fe74fe464/tokio/tests/named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:6 | return Err(e);
}
}
}
};
{
let write_buf = b"pong\n";
let mut write_buf_cursor = 0;
loop {
server.writable().await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 57c90c9750d02c5bca93a939c7d44d7fe74fe464 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57c90c9750d02c5bca93a939c7d44d7fe74fe464/tokio/tests/named_pipe.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:7 | for _ in 0..N {
clients.push(tokio::spawn(async move {
// This showcases a generic connect loop.
//
// We immediately try to create a client, if it's not found or the
// pipe is busy we use the specialized wait function on the client
// builder.
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 57c90c9750d02c5bca93a939c7d44d7fe74fe464 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/57c90c9750d02c5bca93a939c7d44d7fe74fe464/tokio/tests/named_pipe.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:4 | match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break client,
Err(e) if e.raw_os_error() == Some(winerror::ERROR_PIPE_BUSY as i32) => (),
Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:5 | let mut server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for client to connect.
server.connect().await?;
let mut inner = BufReader::new(server);
// Construct the next server to be connected befo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:6 | Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
}
// Wait for a named pipe to become available.
time::sleep(Duration::from_millis(50)).await;
};
let mut read_buf = [0u8; 5];
let mut re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:7 | if ready.is_writable() {
let buf = &write_buf[write_buf_cursor..];
if buf.is_empty() {
continue;
}
match client.try_write(buf) {
Ok(n) => {
write_buf_cursor += n;... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:8 | const PIPE_NAME: &str = r"\\.\pipe\test-named-pipe-mode-message";
let server = ServerOptions::new()
.pipe_mode(PipeMode::Message)
.create(PIPE_NAME)?;
let _ = ClientOptions::new().open(PIPE_NAME)?;
server.connect().await?;
Ok(())
}
fn num_instances(pipe_name: impl AsRef<str>) -> io::R... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:9 | if status as u32 != winerror::NO_ERROR {
return Err(io::Error::last_os_error());
}
let info = unsafe {
mem::transmute::<_, &ntioapi::FILE_DIRECTORY_INFORMATION>(&file_directory_information)
};
let raw_name = unsafe {
std::slice::from_raw_parts(
info.FileName.as_ptr()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 959c5c997f9ff19028819382f268e1ba95277df5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/959c5c997f9ff19028819382f268e1ba95277df5/tokio/tests/named_pipe.rs | 321 | 341 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:4 | match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break client,
Err(e) if e.raw_os_error() == Some(winerror::ERROR_PIPE_BUSY as i32) => (),
Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 97e7830364d5a2d79b38dc89232f91c8c7e75f49 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/97e7830364d5a2d79b38dc89232f91c8c7e75f49/tokio/tests/named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:5 | server.connect().await?;
Ok(())
}
fn num_instances(pipe_name: impl AsRef<str>) -> io::Result<u32> {
use ntapi::ntioapi;
use winapi::shared::ntdef;
let mut name = pipe_name.as_ref().encode_utf16().collect::<Vec<_>>();
let mut name = ntdef::UNICODE_STRING {
Length: (name.len() * mem::size_of... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 97e7830364d5a2d79b38dc89232f91c8c7e75f49 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/97e7830364d5a2d79b38dc89232f91c8c7e75f49/tokio/tests/named_pipe.rs | 161 | 214 |
tokio-rs/tokio:tokio/tests/named_pipe.rs:6 | };
let raw_name = unsafe {
std::slice::from_raw_parts(
info.FileName.as_ptr(),
info.FileNameLength as usize / mem::size_of::<u16>(),
)
};
let name = String::from_utf16(raw_name).unwrap();
let num_instances = unsafe { *info.EndOfFile.QuadPart() };
assert_eq!(n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/named_pipe.rs | MIT | 97e7830364d5a2d79b38dc89232f91c8c7e75f49 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/97e7830364d5a2d79b38dc89232f91c8c7e75f49/tokio/tests/named_pipe.rs | 201 | 214 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
// WASIp1 doesn't support bind
// No `socket` on miri.
#![cfg(all(
feature = "net",
feature = "macros",
feature = "rt",
feature = "io-util",
not(all(target_os = "wasi", target_env = "p1")),
not(miri)
))]
use tokio::net::TcpListener;
use std::net;
#[test]
#[should_pa... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_bind_resource.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::net;
#[test]
#[should_panic]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/net_bind_resource.rs | 1 | 14 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("127.0.0.1:0").ex... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_bind_resource.rs | 1 | 13 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("127.0.0.1:0").expect("faile... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/net_bind_resource.rs | 1 | 13 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | 0c8e8248f8de281f22ad6f30b967053f44fff66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/tests/net_bind_resource.rs | 1 | 13 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::convert::TryFrom;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("127.0.0.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/net_bind_resource.rs | 1 | 14 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind
use tokio::net::TcpListener;
use std::convert::TryFrom;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/net_bind_resource.rs | 1 | 14 |
tokio-rs/tokio:tokio/tests/net_bind_resource.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use std::convert::TryFrom;
use std::net;
#[test]
#[should_panic]
fn no_runtime_panics_binding_net_tcp_listener() {
let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bind listener");
let _ = TcpListener::try... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_bind_resource.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/net_bind_resource.rs | 1 | 14 |
tokio-rs/tokio:tokio/tests/net_driver.rs:1 | #![warn(rust_2018_idioms)]
use tokio::net::driver::Reactor;
use tokio::net::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};
use std::task::Context;
struct Task<T>... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_driver.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/net_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_driver.rs:2 | //
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the task handle is dropped, the task itself is
// dropped.
let mut reactor = assert_ok!(Reactor::new());
let (addr_tx,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_driver.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/net_driver.rs | 41 | 81 |
tokio-rs/tokio:tokio/tests/net_driver.rs:1 | #![warn(rust_2018_idioms)]
use tokio::net::driver::Reactor;
use tokio::net::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};
use std::task::Context;
struct Ta... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_driver.rs | MIT | 94f9b04b066cfc3da5c3ee2c961c21a9496135dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94f9b04b066cfc3da5c3ee2c961c21a9496135dd/tokio/tests/net_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_driver.rs:2 | //
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the task handle is dropped, the task itself is
// dropped.
let mut reactor = assert_ok!(Reactor::new());
let (addr_tx,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_driver.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/tests/net_driver.rs | 41 | 83 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | // WASIp1 doesn't support direct socket operations
#![cfg(all(
feature = "net",
feature = "macros",
feature = "rt",
feature = "io-util",
not(all(target_os = "wasi", target_env = "p1")),
))]
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAdd... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_lookup_host.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support direct socket operations
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/net_lookup_host.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support direct socket operations
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_lookup_host.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support direct socket operations
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/net_lookup_host.rs | 1 | 38 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support direct socket operations
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().unwrap()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/net_lookup_host.rs | 1 | 38 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | #![cfg(feature = "full")]
use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().unwrap();
let actual = assert_ok!(net::lookup_host(addr).await).collect::<V... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/net_lookup_host.rs | 1 | 38 |
tokio-rs/tokio:tokio/tests/net_lookup_host.rs:1 | use tokio::net;
use tokio_test::assert_ok;
use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[tokio::test]
async fn lookup_socket_addr() {
let addr: SocketAddr = "127.0.0.1:8000".parse().unwrap();
let actual = assert_ok!(net::lookup_host(addr).await).collect::<Vec<_>>();
assert_eq!(ve... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_lookup_host.rs | MIT | de5ec6e1bcbb428ee672d7965c0656e628adde46 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/de5ec6e1bcbb428ee672d7965c0656e628adde46/tokio/tests/net_lookup_host.rs | 1 | 36 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(windows)]
use std::io;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY};
#[tokio::test]
async fn t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:2 | server.connect().await?;
let mut server = BufReader::new(server);
let mut buf = String::new();
server.read_line(&mut buf).await?;
server.write_all(b"pong\n").await?;
Ok::<_, io::Error>(buf)
});
let client = tokio::spawn(async move {
let client = ClientOptions::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:3 | let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for client to connect.
server.connect().await?;
let mut inner = BufReader::new(server);
// Construct the next server to be connected before sending the one
// we already have of onto a tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:4 | Err(e) => return Err(e),
}
// Wait for a named pipe to become available.
time::sleep(Duration::from_millis(10)).await;
};
let mut client = BufReader::new(client);
let mut buf = String::new();
client.write_all(b"ping\n").a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:5 | // Wait for client to connect.
server.connect().await?;
let inner_server = server;
// Construct the next server to be connected before sending the one
// we already have of onto a task. This ensures that the server
// isn't closed (after it's done in the tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:6 | };
{
let write_buf = b"pong\n";
let mut write_buf_cursor = 0;
loop {
server.writable().await?;
let buf = &write_buf[write_buf_cursor..];
match server.try_write(buf) {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:7 | //
// We immediately try to create a client, if it's not found or the
// pipe is busy we use the specialized wait function on the client
// builder.
let client = loop {
match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break cl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:8 | Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
continue;
}
Err(e) => {
return Err(e);
}
}
}
if ready.is_writable() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:9 | server.await??;
Ok(())
}
// This tests that message mode works as expected.
#[tokio::test]
async fn test_named_pipe_mode_message() -> io::Result<()> {
// it's easy to accidentally get a seemingly working test here because byte pipes
// often return contents at write boundaries. to make sure we're doing the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:10 | return Ok(());
}
let n = client.read(&mut buf).await?;
if buf[..n] != b"world"[..] {
assert!(matches!(mode, PipeMode::Byte));
return Ok(());
}
}
// byte mode should have errored before.
assert!(matches!(mode, PipeMode::Message));
Ok(())
}
// This ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_named_pipe.rs | 361 | 399 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(all(windows))]
use std::io;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY};
#[tokio::test]
async fn test_named_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:2 | server.connect().await?;
let mut server = BufReader::new(server);
let mut buf = String::new();
server.read_line(&mut buf).await?;
server.write_all(b"pong\n").await?;
Ok::<_, io::Error>(buf)
});
let client = tokio::spawn(async move {
let client = ClientOptions::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:3 | let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for client to connect.
server.connect().await?;
let mut inner = BufReader::new(server);
// Construct the next server to be connected before sending the one
// we already have of onto a tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:4 | Err(e) => return Err(e),
}
// Wait for a named pipe to become available.
time::sleep(Duration::from_millis(10)).await;
};
let mut client = BufReader::new(client);
let mut buf = String::new();
client.write_all(b"ping\n").a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:5 | // Wait for client to connect.
server.connect().await?;
let inner_server = server;
// Construct the next server to be connected before sending the one
// we already have of onto a task. This ensures that the server
// isn't closed (after it's done in the tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:8 | Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
continue;
}
Err(e) => {
return Err(e);
}
}
}
if ready.is_writable() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:9 | server.await??;
Ok(())
}
// This tests what happens when a client tries to disconnect.
#[tokio::test]
async fn test_named_pipe_mode_message() -> io::Result<()> {
const PIPE_NAME: &str = r"\\.\pipe\test-named-pipe-mode-message";
let server = ServerOptions::new()
.pipe_mode(PipeMode::Message)
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 4b032a25a4032da8d34223149e916e2f3e3ab549 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b032a25a4032da8d34223149e916e2f3e3ab549/tokio/tests/net_named_pipe.rs | 321 | 365 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(all(windows))]
use std::io;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY};
#[tokio::test]
async... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 77e39118060b2424d6773d2f692c9eabe8a91717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/77e39118060b2424d6773d2f692c9eabe8a91717/tokio/tests/net_named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(all(windows))]
use std::io;
use std::mem;
use std::os::windows::io::AsRawHandle;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:2 | let server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
// Note: we wait for a client to connect.
server.connect().await?;
let mut server = BufReader::new(server);
let mut buf = String::new();
server.read_line(&mut buf).await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:3 | // The first server needs to be constructed early so that clients can
// be correctly connected. Otherwise calling .wait will cause the client to
// error.
let mut server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for cl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:4 | match ClientOptions::new().open(PIPE_NAME) {
Ok(client) => break client,
Err(e) if e.raw_os_error() == Some(ERROR_PIPE_BUSY as i32) => (),
Err(e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e),
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:5 | let mut server = ServerOptions::new().create(PIPE_NAME)?;
let server = tokio::spawn(async move {
for _ in 0..N {
// Wait for client to connect.
server.connect().await?;
let inner_server = server;
// Construct the next server to be connected before sending t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:6 | return Err(e);
}
}
}
};
{
let write_buf = b"pong\n";
let mut write_buf_cursor = 0;
loop {
server.writable().await?;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:7 | for _ in 0..N {
clients.push(tokio::spawn(async move {
// This showcases a generic connect loop.
//
// We immediately try to create a client, if it's not found or the
// pipe is busy we use the specialized wait function on the client
// builder.
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:8 | if read_buf_cursor == read_buf.len() {
break;
}
}
Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
continue;
}
Err(e) => {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:9 | for client in clients {
let result = client.await?;
assert_eq!(result?, "pong\n");
}
server.await??;
Ok(())
}
// This tests that message mode works as expected.
#[tokio::test]
async fn test_named_pipe_mode_message() -> io::Result<()> {
// it's easy to accidentally get a seemingly worki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:10 | for _ in 0..10 {
let n = server.read(&mut buf).await?;
if buf[..n] != b"hello"[..] {
assert!(matches!(mode, PipeMode::Byte));
return Ok(());
}
let n = client.read(&mut buf).await?;
if buf[..n] != b"world"[..] {
assert!(matches!(mode, PipeMode::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:11 | }
Ok(())
}
fn num_instances(pipe_name: impl AsRef<str>) -> io::Result<u32> {
use ntapi::ntioapi;
let mut name = pipe_name.as_ref().encode_utf16().collect::<Vec<_>>();
let mut name = UNICODE_STRING {
Length: (name.len() * mem::size_of::<u16>()) as u16,
MaximumLength: (name.len() * mem::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 401 | 453 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:12 | let raw_name = unsafe {
std::slice::from_raw_parts(
info.FileName.as_ptr(),
info.FileNameLength as usize / mem::size_of::<u16>(),
)
};
let name = String::from_utf16(raw_name).unwrap();
let num_instances = unsafe { *info.EndOfFile.QuadPart() };
assert_eq!(name, pi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 0a50cb3baa7493e82f5154e38d76a6cff7337676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0a50cb3baa7493e82f5154e38d76a6cff7337676/tokio/tests/net_named_pipe.rs | 441 | 453 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:10 | for _ in 0..10 {
let n = server.read(&mut buf).await?;
if buf[..n] != b"hello"[..] {
assert!(matches!(mode, PipeMode::Byte));
return Ok(());
}
let n = client.read(&mut buf).await?;
if buf[..n] != b"world"[..] {
assert!(matches!(mode, PipeMode::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | a8fda870582a1049bdc31284bc3bb82969014895 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8fda870582a1049bdc31284bc3bb82969014895/tokio/tests/net_named_pipe.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:11 | }
Ok(())
}
fn num_instances(pipe_name: impl AsRef<str>) -> io::Result<u32> {
use ntapi::ntioapi;
let mut name = pipe_name.as_ref().encode_utf16().collect::<Vec<_>>();
let mut name = UNICODE_STRING {
Length: (name.len() * mem::size_of::<u16>()) as u16,
MaximumLength: (name.len() * mem::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | a8fda870582a1049bdc31284bc3bb82969014895 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8fda870582a1049bdc31284bc3bb82969014895/tokio/tests/net_named_pipe.rs | 401 | 453 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:1 | #![cfg(feature = "full")]
#![cfg(all(windows))]
use std::io;
use std::mem;
use std::os::windows::io::AsRawHandle;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ER... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/net_named_pipe.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:8 | if read_buf_cursor == read_buf.len() {
break;
}
}
Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
continue;
}
Err(e) => {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/net_named_pipe.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:9 | for client in clients {
let result = client.await?;
assert_eq!(result?, "pong\n");
}
server.await??;
Ok(())
}
// This tests what happens when a client tries to disconnect.
#[tokio::test]
async fn test_named_pipe_mode_message() -> io::Result<()> {
const PIPE_NAME: &str = r"\\.\pipe\test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/net_named_pipe.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:10 | // Wait for the server to call connect.
rx.await.unwrap();
let _ = ClientOptions::new().read(outb).write(inb).open(PIPE_NAME)?;
server.await??;
}
Ok(())
}
fn num_instances(pipe_name: impl AsRef<str>) -> io::Result<u32> {
use ntapi::ntioapi;
let mut name = pipe_name.as_ref().en... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/net_named_pipe.rs | 361 | 419 |
tokio-rs/tokio:tokio/tests/net_named_pipe.rs:11 | return Err(io::Error::last_os_error());
}
let info = unsafe {
mem::transmute::<_, &ntioapi::FILE_DIRECTORY_INFORMATION>(&file_directory_information)
};
let raw_name = unsafe {
std::slice::from_raw_parts(
info.FileName.as_ptr(),
info.FileNameLength as usize / mem:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_named_pipe.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/net_named_pipe.rs | 401 | 419 |
tokio-rs/tokio:tokio/tests/net_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
#![cfg(panic = "unwind")]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
#[cfg_attr(miri, ignore)] //... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_panic.rs:2 | std_listener.set_nonblocking(true).unwrap();
let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = TcpListener::from_std(std_listener);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_fil... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_panic.rs:3 | use tokio::net::UnixListener;
let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = UnixListener::bind(&sock_path);
});
});
// The ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_panic.rs:4 | #[test]
#[cfg(unix)]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::net::UnixStream;
let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let _std_listener = std::os::unix::net::UnixListen... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_panic.rs:5 | let panic_location_file = test_panic(move || {
let rt = runtime_without_io();
rt.block_on(async {
let _ = UnixDatagram::from_std(std_socket);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
#... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/net_panic.rs | 161 | 196 |
tokio-rs/tokio:tokio/tests/net_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))]
#![cfg(panic = "unwind")]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
fn udp_socket_fro... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_panic.rs:2 | let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = TcpListener::from_std(std_listener);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
fn tc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_panic.rs:3 | let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = UnixListener::bind(&sock_path);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
#[cfg(unix... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_panic.rs:4 | let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let _std_listener = std::os::unix::net::UnixListener::bind(&sock_path).unwrap();
let std_stream = std::os::unix::net::UnixStream::connect(&sock_path).unwrap();
let panic_location_file = test_panic(|| {
let rt = r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_panic.rs:5 | // The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
#[cfg(windows)]
fn server_options_max_instances_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::net::windows::named_pipe::ServerOptions;
let panic_location_file = test_panic(mov... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/net_panic.rs | 161 | 189 |
tokio-rs/tokio:tokio/tests/net_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
#![cfg(panic = "unwind")]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
fn udp_socket_from_std_panic... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 58edfc61abe4acdc2dda485c1d66715790b9315c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/net_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[cfg(panic = "unwind")]
#[test]
fn udp_socket_from_std_panic_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/net_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_panic.rs:2 | let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = TcpListener::from_std(std_listener);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[cfg(panic =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/net_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/net_panic.rs:3 | let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = UnixListener::bind(&sock_path);
});
});
// The panic location should be in this fi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/net_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_panic.rs:4 | fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::net::UnixStream;
let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let _std_listener = std::os::unix::net::UnixListener::bind(&sock_path).unwrap();
let std_stream = std::os::unix::net:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/net_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_panic.rs:5 | });
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[cfg(panic = "unwind")]
#[test]
#[cfg(windows)]
fn server_options_max_instances_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::net::windows::named_pipe::ServerOptions;
let pa... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/net_panic.rs | 161 | 192 |
tokio-rs/tokio:tokio/tests/net_panic.rs:3 | let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let panic_location_file = test_panic(|| {
let rt = runtime_without_io();
rt.block_on(async {
let _ = UnixListener::bind(&sock_path);
});
});
// The panic location should be in this fi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/net_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/net_panic.rs:4 | fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::net::UnixStream;
let dir = tempfile::tempdir().unwrap();
let sock_path = dir.path().join("socket");
let _std_listener = std::os::unix::net::UnixListener::bind(&sock_path).unwrap();
let std_stream = std::os::unix::net:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/net_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/net_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
fn udp_socket_from_std_panic_caller() -> Result<(), Bo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/net_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/net_panic.rs:2 | let rt = runtime_without_io();
rt.block_on(async {
let _ = TcpListener::from_std(std_listener);
});
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
fn tcp_stream_from_std_panic_caller() -> Result<(), Box... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/net_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/net_panic.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.