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/io_driver.rs:2 | // that same lock in order to clean up state.
//
// 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 rt = runt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/tests/io_driver.rs | 41 | 86 |
tokio-rs/tokio:tokio/tests/io_driver.rs:2 | // that same lock in order to clean up state.
//
// 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 rt = runt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/io_driver.rs | 41 | 87 |
tokio-rs/tokio:tokio/tests/io_driver.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
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;
s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/io_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_driver.rs:2 | // that same lock in order to clean up state.
//
// 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 rt = runt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/io_driver.rs | 41 | 88 |
tokio-rs/tokio:tokio/tests/io_driver.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
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;
s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/io_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_driver.rs:2 | // that same lock in order to clean up state.
//
// 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 rt = runt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/io_driver.rs | 41 | 88 |
tokio-rs/tokio:tokio/tests/io_driver.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
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;
s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_driver.rs:2 | // that same lock in order to clean up state.
//
// 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 rt = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_driver.rs | 41 | 88 |
tokio-rs/tokio:tokio/tests/io_driver.rs:1 | #![warn(rust_2018_idioms)]
use tokio::net::TcpListener;
use tokio::runtime;
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> {
future... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/io_driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_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 rt = runtime::Builder::new()
.basic_scheduler()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/io_driver.rs | 41 | 87 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
fn tcp_doesnt_block() {
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_driver_drop.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:2 | TcpListener::from_std(listener).unwrap()
};
let mut task = task::spawn(async move {
assert_err!(listener.accept().await);
});
assert_pending!(task.poll());
drop(rt);
assert!(task.is_woken());
assert_ready!(task.poll());
}
fn rt() -> runtime::Runtime {
runtime::Builder::new_c... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_driver_drop.rs | 41 | 62 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
fn tcp_doesnt_block() {
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 4047d7962a02722859b0f1c7bbcd85bc1bfc865d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/io_driver_drop.rs | 1 | 56 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/io_driver_drop.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = {
let _ente... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_driver_drop.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support bind
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = {
let _enter = rt.e... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/io_driver_drop.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = {
let _enter = rt.enter();
let listener = std::net::TcpListener... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/tests/io_driver_drop.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = rt.enter(|| {
let listener = std::net::TcpListener::bind("127.0.0.1:0")... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/io_driver_drop.rs | 1 | 52 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let listener = rt.enter(|| {
let listener = std::net::TcpListener::bind("127.0.0.1:0")... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 066965cd59d01fd9d999152e32169a24dfe434fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/066965cd59d01fd9d999152e32169a24dfe434fa/tokio/tests/io_driver_drop.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let mut listener = rt.enter(|| {
let listener = std::net::TcpListener::bind("127.0.0.1... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_driver_drop.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = rt();
let mut listener = rt.enter(|| {
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
Tcp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/io_driver_drop.rs | 1 | 52 |
tokio-rs/tokio:tokio/tests/io_driver_drop.rs:1 | #![warn(rust_2018_idioms)]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_err, assert_pending, assert_ready, task};
#[test]
fn tcp_doesnt_block() {
let rt = runtime::Builder::new().basic_scheduler().build().unwrap();
let mut listener = rt.enter(|| {
let listener = std::net::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_driver_drop.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/tests/io_driver_drop.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/io_fill_buf.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, BufReader};
use tokio_test::assert_ok;
#[tokio::test]
async fn fill_buf_file() {
let file = NamedTempFile::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_fill_buf.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_fill_buf.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/io_fill_buf.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, BufReader};
use tokio_test::assert_ok;
#[tokio::test]
async fn fill_buf_file() {
let file = NamedTempFile::new().un... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_fill_buf.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/io_fill_buf.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/io_fill_buf.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, BufReader};
use tokio_test::assert_ok;
#[tokio::test]
async fn fill_buf_file() {
let file = NamedTempFile::new().unwrap();
assert_ok!(std::fs::write(file.path(), b"hello"));... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_fill_buf.rs | MIT | 1409041525cc81d81b3405c59e5d001b1ec1ddcb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1409041525cc81d81b3405c59e5d001b1ec1ddcb/tokio/tests/io_fill_buf.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/io_join.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{join, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, Join, ReadBuf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct R;
impl AsyncRead for R {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_join.rs:2 | fn poll_write_vectored(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
_bufs: &[io::IoSlice<'_>],
) -> Poll<Result<usize, io::Error>> {
Poll::Ready(Ok(2))
}
fn is_write_vectored(&self) -> bool {
true
}
}
#[test]
fn is_send_and_sync() {
fn assert_bound<T: Send ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_join.rs | 41 | 81 |
tokio-rs/tokio:tokio/tests/io_join.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{join, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, Join, ReadBuf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct R;
impl AsyncRead for R {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_join.rs | MIT | bd15bace3505a1945a21cb7c8b3db013320fd0f8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd15bace3505a1945a21cb7c8b3db013320fd0f8/tokio/tests/io_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_join.rs:2 | fn poll_write_vectored(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
_bufs: &[io::IoSlice<'_>],
) -> Poll<Result<usize, io::Error>> {
Poll::Ready(Ok(2))
}
fn is_write_vectored(&self) -> bool {
true
}
}
#[test]
fn is_send_and_sync() {
fn assert_bound<T: Send ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_join.rs | MIT | bd15bace3505a1945a21cb7c8b3db013320fd0f8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd15bace3505a1945a21cb7c8b3db013320fd0f8/tokio/tests/io_join.rs | 41 | 83 |
tokio-rs/tokio:tokio/tests/io_lines.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn lines_inherent() {
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();
let b = assert_ok!(st.next_line().await).unwrap();
assert_eq!(b, "hello");
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_lines.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_lines.rs | 1 | 19 |
tokio-rs/tokio:tokio/tests/io_lines.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn lines_inherent() {
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();
let b = assert_ok!(st.next_line().await).unwrap();
assert_eq!(b, "hello");
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_lines.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/io_lines.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/io_lines.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn lines_inherent() {
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();
let b = assert_ok!(st.next_line().await).unwrap();
assert_eq!(b, "hello");
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_lines.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_lines.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/io_lines.rs:1 | #![warn(rust_2018_idioms)]
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn lines_inherent() {
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();
let b = assert_ok!(st.next_line().await).unwrap();
assert_eq!(b, "hello");
let b = assert_ok!(st.next_li... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_lines.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/io_lines.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/io_lines.rs:1 | #![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
use futures_util::StreamExt;
use tokio::io::{AsyncBufRead, AsyncBufReadExt, AsyncRead};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn lines() {
struct Rd {
val: &'static [u8]... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_lines.rs | MIT | 6742816e78dad0d2ae8137671cc409258df70acf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6742816e78dad0d2ae8137671cc409258df70acf/tokio/tests/io_lines.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{duplex, AsyncReadExt, AsyncWriteExt};
#[tokio::test]
async fn ping_pong() {
let (mut a, mut b) = duplex(32);
let mut buf = [0u8; 4];
a.write_all(b"ping").await.unwrap();
b.read_exact(&mut buf).await.unwrap();
assert_eq!(&buf, b... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_mem_stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:2 | }
#[tokio::test]
async fn disconnect() {
let (mut a, mut b) = duplex(32);
let t1 = tokio::spawn(async move {
a.write_all(b"ping").await.unwrap();
// and dropped
});
let t2 = tokio::spawn(async move {
let mut buf = [0u8; 32];
let n = b.read(&mut buf).await.unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_mem_stream.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:3 | t1.await.unwrap();
}
#[tokio::test]
async fn max_write_size() {
let (mut a, mut b) = duplex(32);
let t1 = tokio::spawn(async move {
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 32);
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 4);
});
let mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_mem_stream.rs | 81 | 121 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:3 | t1.await.unwrap();
}
#[tokio::test]
async fn max_write_size() {
let (mut a, mut b) = duplex(32);
let t1 = tokio::spawn(async move {
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 32);
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 4);
});
let mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | fd4d2b0a9914967df31cdb9f8430af52cd65b207 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fd4d2b0a9914967df31cdb9f8430af52cd65b207/tokio/tests/io_mem_stream.rs | 81 | 121 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:3 | t1.await.unwrap();
}
#[tokio::test]
async fn max_write_size() {
let (mut a, mut b) = duplex(32);
let t1 = tokio::spawn(async move {
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 32);
let n = a.write(&[0u8; 64]).await.unwrap();
assert_eq!(n, 4);
});
let mut ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | d4075a445770bd5f4982006ec6f7b60d3fb6373e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4075a445770bd5f4982006ec6f7b60d3fb6373e/tokio/tests/io_mem_stream.rs | 81 | 102 |
tokio-rs/tokio:tokio/tests/io_mem_stream.rs:2 | }
#[tokio::test]
async fn disconnect() {
let (mut a, mut b) = duplex(32);
let t1 = tokio::spawn(async move {
a.write_all(b"ping").await.unwrap();
// and dropped
});
let t2 = tokio::spawn(async move {
let mut buf = [0u8; 32];
let n = b.read(&mut buf).await.unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_mem_stream.rs | MIT | 0e090b7ae2c79c35389adab5effaedf825590d87 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0e090b7ae2c79c35389adab5effaedf825590d87/tokio/tests/io_mem_stream.rs | 41 | 83 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
#![cfg(panic = "unwind")]
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_panic.rs:2 | Poll::Ready(Ok(()))
}
}
#[cfg(unix)]
mod unix {
use std::os::unix::prelude::{AsRawFd, RawFd};
pub struct MockFd;
impl AsRawFd for MockFd {
fn as_raw_fd(&self) -> RawFd {
0
}
}
}
#[test]
fn read_buf_initialize_unfilled_to_panic_caller() -> Result<(), Box<dyn Error>> {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_panic.rs:3 | // The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
fn read_buf_set_filled_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let mut buffer = Vec::<u8>::new();
let mut read_buf = ReadBuf::n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_panic.rs:4 | fn unsplit_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let (r1, _w1) = split(RW);
let (_r2, w2) = split(RW);
r1.unsplit(w2);
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/io_panic.rs:5 | use tokio::runtime::Builder;
let panic_location_file = test_panic(|| {
// Runtime without `enable_io` so it has no IO driver set.
let rt = Builder::new_current_thread().build().unwrap();
rt.block_on(async {
let fd = unix::MockFd;
let _ = AsyncFd::with_interest(fd, I... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/io_panic.rs:6 | #[test]
#[cfg(unix)]
fn async_fd_try_with_interest_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::io::unix::AsyncFd;
use tokio::io::Interest;
use tokio::runtime::Builder;
let panic_location_file = test_panic(|| {
// Runtime without `enable_io` so it has no IO driver set.
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_panic.rs | 201 | 222 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
#![cfg(panic = "unwind")]
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | e37bd6385430620f850a644d58945ace541afb6e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e37bd6385430620f850a644d58945ace541afb6e/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_panic.rs:4 | fn unsplit_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let (r1, _w1) = split(RW);
let (_r2, w2) = split(RW);
r1.unsplit(w2);
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | 58edfc61abe4acdc2dda485c1d66715790b9315c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/io_panic.rs | 121 | 177 |
tokio-rs/tokio:tokio/tests/io_panic.rs:5 | use tokio::runtime::Builder;
let panic_location_file = test_panic(|| {
// Runtime without `enable_io` so it has no IO driver set.
let rt = Builder::new_current_thread().build().unwrap();
rt.block_on(async {
let fd = unix::MockFd;
let _ = AsyncFd::with_interest(fd, I... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | 58edfc61abe4acdc2dda485c1d66715790b9315c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/io_panic.rs | 161 | 177 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use support::panic::test_panic;... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_panic.rs:2 | }
}
#[cfg(unix)]
mod unix {
use std::os::unix::prelude::{AsRawFd, RawFd};
pub struct MockFd;
impl AsRawFd for MockFd {
fn as_raw_fd(&self) -> RawFd {
0
}
}
}
#[cfg(panic = "unwind")]
#[test]
fn read_buf_initialize_unfilled_to_panic_caller() -> Result<(), Box<dyn Error>> {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/io_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_panic.rs:3 | });
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[cfg(panic = "unwind")]
#[test]
fn read_buf_set_filled_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let mut buffer = Vec::<u8>::new();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/io_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_panic.rs:4 | }
#[cfg(panic = "unwind")]
#[test]
fn unsplit_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let (r1, _w1) = split(RW);
let (_r2, w2) = split(RW);
r1.unsplit(w2);
});
// The panic location should be in this file
assert_eq!(&panic_locati... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/io_panic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/io_panic.rs:5 | #[cfg(unix)]
fn async_fd_with_interest_panic_caller() -> Result<(), Box<dyn Error>> {
use tokio::io::unix::AsyncFd;
use tokio::io::Interest;
use tokio::runtime::Builder;
let panic_location_file = test_panic(|| {
// Runtime without `enable_io` so it has no IO driver set.
let rt = Builder... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | d8a4a5f24bfc5012071eec4e501bb4a58a1181d6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/io_panic.rs | 161 | 181 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use support::panic::test_panic;... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_panic.rs:2 | }
}
#[cfg(unix)]
mod unix {
use std::os::unix::prelude::{AsRawFd, RawFd};
pub struct MockFd;
impl AsRawFd for MockFd {
fn as_raw_fd(&self) -> RawFd {
0
}
}
}
#[test]
fn read_buf_initialize_unfilled_to_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_panic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_panic.rs:3 | // The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
fn read_buf_set_filled_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let mut buffer = Vec::<u8>::new();
let mut read_buf = ReadBuf::n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_panic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_panic.rs:4 | let panic_location_file = test_panic(|| {
let (r1, _w1) = split(RW);
let (_r2, w2) = split(RW);
r1.unsplit(w2);
});
// The panic location should be in this file
assert_eq!(&panic_location_file.unwrap(), file!());
Ok(())
}
#[test]
#[cfg(unix)]
fn async_fd_new_panic_caller() -> ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_panic.rs | 121 | 176 |
tokio-rs/tokio:tokio/tests/io_panic.rs:5 | let panic_location_file = test_panic(|| {
// Runtime without `enable_io` so it has no IO driver set.
let rt = Builder::new_current_thread().build().unwrap();
rt.block_on(async {
let fd = unix::MockFd;
let _ = AsyncFd::with_interest(fd, Interest::READABLE);
});
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/io_panic.rs | 161 | 176 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support panic recovery
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use support::panic::test_panic;
struct... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use support::panic::test_panic;
struct RW;
impl AsyncRead for RW {
fn poll_read(
self: ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_panic.rs | MIT | b51aa8f6f9cb205a8444743429cc80a86f982f1d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b51aa8f6f9cb205a8444743429cc80a86f982f1d/tokio/tests/io_panic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(target_os = "freebsd", feature = "net"))]
use mio_aio::{AioFsyncMode, SourceApi};
use std::{
future::Future,
io, mem,
os::fd::{AsFd, BorrowedFd},
os::unix::io::AsRawFd,
pin::{pin, Pin},
task::{Context, Poll},
};
use tempfile::tempfile;
use tokio::io::bsd::{... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:2 | }
}
}
impl<'fd> Future for FsyncFut<'fd> {
type Output = io::Result<()>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let poll_result = self.0.poll_ready(cx);
match poll_result {
Poll::Pending => Poll::Pending,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:3 | }
impl AioSource for LlSource {
fn register_borrowed(&mut self, kq: BorrowedFd<'_>, token: usize) {
let mut sev: libc::sigevent = unsafe { mem::MaybeUninit::zeroed().assume_init() };
sev.sigev_notify = libc::SIGEV_KEVENT;
sev.sigev_signo = kq.as_raw_fd();
sev... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:4 | // returned Ready. But that's ok; most futures behave this
// way.
self.0.clear_ready(ev);
let r = unsafe { libc::aio_return(self.0 .0.as_mut().get_unchecked_mut()) };
if r >= 0 {
Poll::Ready(Ok(r as usize))
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:5 | fut.await.unwrap();
}
/// A suitably crafted future type can reuse an Aio object
#[tokio::test]
async fn reuse() {
let f = tempfile().unwrap();
let fd = f.as_raw_fd();
let mut aiocb: libc::aiocb = unsafe { mem::MaybeUninit::zeroed().assume_init() };
aiocb.aio_fildes = fd... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:6 | /// doesn't include any bindings for lio_listio, so we've got to go
/// low-level.
struct LioSource<'a> {
aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>,
sev: libc::sigevent,
}
impl<'a> LioSource<'a> {
fn new(aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>) -> Self {
LioS... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:7 | struct LioFut<'a>(Aio<LioSource<'a>>);
impl<'a> LioFut<'a> {
pub fn submit(self: Pin<&mut Self>) {
let p = unsafe { self.map_unchecked_mut(|s| &mut *(s.0)) };
p.submit();
}
}
impl<'a> Future for LioFut<'a> {
type Output = std::io::Result<usize>;
fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:8 | }
}
/// An lio_listio operation with one fsync element
#[tokio::test]
async fn onewrite() {
const WBUF: &[u8] = b"abcdef";
let f = tempfile().unwrap();
let mut aiocb: libc::aiocb = unsafe { mem::zeroed() };
aiocb.aio_fildes = f.as_raw_fd();
aiocb.aio_lio_opcode ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 281 | 339 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:9 | let mut fut = LioFut(poll_aio);
{
let mut pfut = Pin::new(&mut fut);
pfut.as_mut().submit();
pfut.as_mut().await.unwrap();
}
// Check that readiness was cleared
let mut ctx = Context::from_waker(futures::task::noop_waker_ref());
assert_pending... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_poll_aio.rs | 321 | 339 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(target_os = "freebsd", feature = "net"))]
use mio_aio::{AioFsyncMode, SourceApi};
use std::{
future::Future,
io, mem,
os::fd::AsFd,
os::unix::io::{AsRawFd, RawFd},
pin::{pin, Pin},
task::{Context, Poll},
};
use tempfile::tempfile;
use tokio::io::bsd::{Aio, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 12920cea45e81bf831eb7174a3337b6d06b0b27d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12920cea45e81bf831eb7174a3337b6d06b0b27d/tokio/tests/io_poll_aio.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:2 | }
}
}
impl<'fd> Future for FsyncFut<'fd> {
type Output = io::Result<()>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let poll_result = self.0.poll_ready(cx);
match poll_result {
Poll::Pending => Poll::Pending,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 12920cea45e81bf831eb7174a3337b6d06b0b27d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12920cea45e81bf831eb7174a3337b6d06b0b27d/tokio/tests/io_poll_aio.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:3 | }
impl AioSource for LlSource {
fn register(&mut self, kq: RawFd, token: usize) {
let mut sev: libc::sigevent = unsafe { mem::MaybeUninit::zeroed().assume_init() };
sev.sigev_notify = libc::SIGEV_KEVENT;
sev.sigev_signo = kq;
sev.sigev_value = libc::sigval {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 12920cea45e81bf831eb7174a3337b6d06b0b27d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12920cea45e81bf831eb7174a3337b6d06b0b27d/tokio/tests/io_poll_aio.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:6 | /// doesn't include any bindings for lio_listio, so we've got to go
/// low-level.
struct LioSource<'a> {
aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>,
sev: libc::sigevent,
}
impl<'a> LioSource<'a> {
fn new(aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>) -> Self {
LioS... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 12920cea45e81bf831eb7174a3337b6d06b0b27d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12920cea45e81bf831eb7174a3337b6d06b0b27d/tokio/tests/io_poll_aio.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(target_os = "freebsd", feature = "net"))]
use mio_aio::{AioFsyncMode, SourceApi};
use std::{
future::Future,
io, mem,
os::unix::io::{AsRawFd, RawFd},
pin::{pin, Pin},
task::{Context, Poll},
};
use tempfile::tempfile;
use tokio::io::bsd::{Aio, AioSource};
use to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:2 | }
}
impl Future for FsyncFut {
type Output = io::Result<()>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let poll_result = self.0.poll_ready(cx);
match poll_result {
Poll::Pending => Poll::Pending,
Poll::Re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:3 | impl AioSource for LlSource {
fn register(&mut self, kq: RawFd, token: usize) {
let mut sev: libc::sigevent = unsafe { mem::MaybeUninit::zeroed().assume_init() };
sev.sigev_notify = libc::SIGEV_KEVENT;
sev.sigev_signo = kq;
sev.sigev_value = libc::sigval {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:4 | // way.
self.0.clear_ready(ev);
let r = unsafe { libc::aio_return(self.0 .0.as_mut().get_unchecked_mut()) };
if r >= 0 {
Poll::Ready(Ok(r as usize))
} else {
Poll::Ready(Err(io::Error::last_os... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:5 | }
/// A suitably crafted future type can reuse an Aio object
#[tokio::test]
async fn reuse() {
let f = tempfile().unwrap();
let fd = f.as_raw_fd();
let mut aiocb: libc::aiocb = unsafe { mem::MaybeUninit::zeroed().assume_init() };
aiocb.aio_fildes = fd;
let source = L... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:6 | /// low-level.
struct LioSource<'a> {
aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>,
sev: libc::sigevent,
}
impl<'a> LioSource<'a> {
fn new(aiocb: Pin<&'a mut [&'a mut libc::aiocb; 1]>) -> Self {
LioSource {
aiocb,
sev: unsafe { mem::zeroed... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:7 | struct LioFut<'a>(Aio<LioSource<'a>>);
impl<'a> LioFut<'a> {
pub fn submit(self: Pin<&mut Self>) {
let p = unsafe { self.map_unchecked_mut(|s| &mut *(s.0)) };
p.submit();
}
}
impl<'a> Future for LioFut<'a> {
type Output = std::io::Result<usize>;
fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:8 | }
/// An lio_listio operation with one fsync element
#[tokio::test]
async fn onewrite() {
const WBUF: &[u8] = b"abcdef";
let f = tempfile().unwrap();
let mut aiocb: libc::aiocb = unsafe { mem::zeroed() };
aiocb.aio_fildes = f.as_raw_fd();
aiocb.aio_lio_opcode = libc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 281 | 338 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:9 | {
let mut pfut = Pin::new(&mut fut);
pfut.as_mut().submit();
pfut.as_mut().await.unwrap();
}
// Check that readiness was cleared
let mut ctx = Context::from_waker(futures::task::noop_waker_ref());
assert_pending!(fut.0.poll_ready(&mut ctx));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e929d0e8b9aa46d4b7cad0f5d692ad94f5b2da45/tokio/tests/io_poll_aio.rs | 321 | 338 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(target_os = "freebsd", feature = "net"))]
use mio_aio::{AioCb, AioFsyncMode, LioCb};
use std::{
future::Future,
mem,
os::unix::io::{AsRawFd, RawFd},
pin::Pin,
task::{Context, Poll},
};
use tempfile::tempfile;
use tokio::io::bsd::{Aio, AioSource};
use tokio_test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:2 | Poll::Ready(Ok(_ev)) => {
// At this point, we could clear readiness. But there's no
// point, since we're about to drop the Aio.
let result = (*self.0).0.aio_return();
match result {
Ok(_) => Poll::Ready(Ok(())),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:3 | type Output = std::io::Result<()>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let poll_result = self.0.poll_ready(cx);
match poll_result {
Poll::Pending => Poll::Pending,
Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:4 | }
}
impl AioSource for ReusableFsyncSource {
fn register(&mut self, kq: RawFd, token: usize) {
self.fd = kq;
self.token = token;
}
fn deregister(&mut self) {
self.fd = 0;
}
}
struct ReusableFsyncFut<'a>(&'a mut Aio<ReusableFsyncSource>... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:5 | let f = tempfile().unwrap();
let fd = f.as_raw_fd();
let aiocb = AioCb::from_fd(fd, 0);
let source = WrappedAioCb(aiocb);
let mut poll_aio = Aio::new_for_aio(source).unwrap();
(*poll_aio).0.fsync(AioFsyncMode::O_SYNC).unwrap();
let fut = FsyncFut(poll_aio);
fut.aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:6 | poll_aio.reset(aiocb1);
let mut ctx = Context::from_waker(futures::task::noop_waker_ref());
assert_pending!(poll_aio.poll_ready(&mut ctx));
poll_aio.fsync();
let fut1 = ReusableFsyncFut(&mut poll_aio);
fut1.await.unwrap();
}
}
mod lio {
use super::*;
struct WrappedL... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:7 | }
}
}
}
/// Minimal example demonstrating reuse of an Aio object with lio
/// readiness. mio_aio::LioCb actually does something similar under the
/// hood.
struct ReusableLioSource {
liocb: Option<LioCb<'static>>,
fd: RawFd,
token: usize,
}
impl ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:8 | }
struct ReusableLioFut<'a>(&'a mut Aio<ReusableLioSource>);
impl<'a> Future for ReusableLioFut<'a> {
type Output = std::io::Result<Vec<isize>>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let poll_result = self.0.poll_ready(cx);
match... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:9 | let liocb = builder.finish();
let source = WrappedLioCb(liocb);
let mut poll_aio = Aio::new_for_lio(source).unwrap();
// Send the operation to the kernel
(*poll_aio).0.submit().unwrap();
let fut = LioFut(Some(poll_aio));
let v = fut.await.unwrap();
assert_eq!(v.l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 321 | 375 |
tokio-rs/tokio:tokio/tests/io_poll_aio.rs:10 | &WBUF[..],
0,
mio_aio::LioOpcode::LIO_WRITE,
);
let liocb1 = builder1.finish();
poll_aio.reset(liocb1);
let mut ctx = Context::from_waker(futures::task::noop_waker_ref());
assert_pending!(poll_aio.poll_ready(&mut ctx));
poll_aio.submit();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_poll_aio.rs | MIT | 8b298d9ed41930c071f023a43bf0ded64ea1129e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b298d9ed41930c071f023a43bf0ded64ea1129e/tokio/tests/io_poll_aio.rs | 361 | 375 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
mod support {
pub(crate) mod leaked_buffers;
}
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_read.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_read.rs:2 | assert_eq!(n, 11);
assert_eq!(buf[..], b"hello world"[..]);
}
struct BadAsyncRead {
leaked_buffers: LeakedBuffers,
}
impl BadAsyncRead {
fn new() -> Self {
Self {
leaked_buffers: LeakedBuffers::new(),
}
}
}
impl AsyncRead for BadAsyncRead {
fn poll_read(
mut se... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_read.rs | 41 | 75 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support panic recovery
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
mod support {
pub(crate) mod leaked_buffers;
}
use suppo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/io_read.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
mod support {
pub(crate) mod leaked_buffers;
}
use support::leaked_buffers::LeakedBuffers;
#[tokio::test]
async fn re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | 454ac1c54fa992004787c109e61bf232697d3652 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/454ac1c54fa992004787c109e61bf232697d3652/tokio/tests/io_read.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn read() {
#[derive(Default)]
struct Rd {
poll_cnt: usize,
}
impl AsyncRead... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | 8dbc3c79379f2243fc04d444239d009c1c610016 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8dbc3c79379f2243fc04d444239d009c1c610016/tokio/tests/io_read.rs | 1 | 59 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn read() {
#[derive(Default)]
struct Rd {
poll_cnt: usize,
}
impl AsyncRead... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | f8c91f2ead24ed6e268a820405c329032dd30da6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f8c91f2ead24ed6e268a820405c329032dd30da6/tokio/tests/io_read.rs | 1 | 38 |
tokio-rs/tokio:tokio/tests/io_read.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn read() {
#[derive(Default)]
struct Rd {
poll_cnt: usize,
}
impl AsyncRead... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/io_read.rs | MIT | c393236dfd12c13e82badd631d3a3a90481c6f95 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/tests/io_read.rs | 1 | 38 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.