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/src/signal/windows/sys.rs:4
use super::*; use crate::runtime::Runtime; use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task}; unsafe fn raise_event(signum: u32) { if event_requires_infinite_sleep_in_handler(signum) { // Those events will enter an infinite loop in `handler`, so // we need ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
// Windows doesn't have a good programmatic way of sending events // like sending signals on Unix, so we'll stub out the actual OS // integration and test that our handling works. unsafe { raise_event(console::CTRL_BREAK_EVENT); } ctrl_break.r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
unsafe { raise_event(console::CTRL_SHUTDOWN_EVENT); } ctrl_shutdown.recv().await.unwrap(); }); } #[test] fn ctrl_logoff() { let rt = rt(); rt.block_on(async { let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs
201
232
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::io; use std::sync::OnceLock; use crate::signal::registry::{globals, EventId, EventInfo, Storage}; use crate::signal::RxFuture; use windows_sys::core::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVENT) } pub(super...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
// For more information, see: // https://learn.microsoft.com/en-us/windows/console/handlerroutine#remarks match signum { console::CTRL_CLOSE_EVENT => true, console::CTRL_LOGOFF_EVENT => true, console::CTRL_SHUTDOWN_EVENT => true, _ => false, } } #[derive(Debug, Default)] pub...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
} } #[derive(Debug, Default)] pub(crate) struct OsExtraData {} fn global_init() -> io::Result<()> { static INIT: OnceLock<Result<(), Option<i32>>> = OnceLock::new(); INIT.get_or_init(|| { let rc = unsafe { console::SetConsoleCtrlHandler(Some(handler), 1) }; if rc == 0 { Err(io::Er...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
if event_was_handled { 1 } else { // No one is listening for this notification any more // let the OS fire the next (possibly the default) handler. 0 } } #[cfg(all(test, not(loom)))] mod tests { use super::*; use crate::runtime::Runtime; use tokio_test::{assert_ok, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
raise_event(console::CTRL_C_EVENT); } assert_ready_ok!(ctrl_c.poll()); } #[test] fn ctrl_break() { let rt = rt(); rt.block_on(async { let mut ctrl_break = assert_ok!(crate::signal::windows::ctrl_break()); // Windows doesn't have a good programmatic...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
} #[test] fn ctrl_shutdown() { let rt = rt(); rt.block_on(async { let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown()); // Windows doesn't have a good programmatic way of sending events // like sending signals on Unix, so we'll stub o...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
240cc44da87ac30188e946ed1003b0e67f64aad8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/240cc44da87ac30188e946ed1003b0e67f64aad8/tokio/src/signal/windows/sys.rs
201
244
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Storage}; use crate::signal::RxFuture; use windows_sys::core::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVENT) } pub(super) fn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
46674789abdcd72189bb48a82c6c2121bc3922a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/46674789abdcd72189bb48a82c6c2121bc3922a0/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
// For more information, see: // https://learn.microsoft.com/en-us/windows/console/handlerroutine#remarks match signum { console::CTRL_CLOSE_EVENT => true, console::CTRL_LOGOFF_EVENT => true, console::CTRL_SHUTDOWN_EVENT => true, _ => false, } } #[derive(Debug, Default)] pub...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
46674789abdcd72189bb48a82c6c2121bc3922a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/46674789abdcd72189bb48a82c6c2121bc3922a0/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
} } #[derive(Debug, Default)] pub(crate) struct OsExtraData {} fn global_init() -> io::Result<()> { static INIT: Once = Once::new(); let mut init = None; INIT.call_once(|| unsafe { let rc = console::SetConsoleCtrlHandler(Some(handler), 1); let ret = if rc == 0 { Err(io::Error...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
46674789abdcd72189bb48a82c6c2121bc3922a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/46674789abdcd72189bb48a82c6c2121bc3922a0/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use windows_sys::core::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVENT) } pub(sup...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
// For more information, see: // https://learn.microsoft.com/en-us/windows/console/handlerroutine#remarks match signum { console::CTRL_CLOSE_EVENT => true, console::CTRL_LOGOFF_EVENT => true, console::CTRL_SHUTDOWN_EVENT => true, _ => false, } } #[derive(Debug)] pub(crate) s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
} } fn for_each<'a, F>(&'a self, mut f: F) where F: FnMut(&'a EventInfo), { f(&self.ctrl_break); f(&self.ctrl_close); f(&self.ctrl_c); f(&self.ctrl_logoff); f(&self.ctrl_shutdown); } } #[derive(Debug)] pub(crate) struct OsExtraData {} impl Init for ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
init.unwrap_or_else(|| Ok(())) } unsafe extern "system" fn handler(ty: u32) -> BOOL { let globals = globals(); globals.record_event(ty as EventId); // According to https://docs.microsoft.com/en-us/windows/console/handlerroutine // the handler routine is always invoked in a new thread, thus we don't ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
} else { unsafe { super::handler(signum) }; } } #[test] fn ctrl_c() { let rt = rt(); let _enter = rt.enter(); let mut ctrl_c = task::spawn(crate::signal::ctrl_c()); assert_pending!(ctrl_c.poll()); // Windows doesn't have a good programmatic way...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
} #[test] fn ctrl_close() { let rt = rt(); rt.block_on(async { let mut ctrl_close = assert_ok!(crate::signal::windows::ctrl_close()); // Windows doesn't have a good programmatic way of sending events // like sending signals on Unix, so we'll stub out the ac...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
201
260
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:7
let rt = rt(); rt.block_on(async { let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()); // Windows doesn't have a good programmatic way of sending events // like sending signals on Unix, so we'll stub out the actual OS // integration and test...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/signal/windows/sys.rs
241
262
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
init.unwrap_or_else(|| Ok(())) } unsafe extern "system" fn handler(ty: u32) -> BOOL { let globals = globals(); globals.record_event(ty as EventId); // According to https://docs.microsoft.com/en-us/windows/console/handlerroutine // the handler routine is always invoked in a new thread, thus we don't ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
9255d96b1b5d6ac85e348d718ed69ea2f80b585c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9255d96b1b5d6ac85e348d718ed69ea2f80b585c/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
} else { super::handler(signum); } } #[test] fn ctrl_c() { let rt = rt(); let _enter = rt.enter(); let mut ctrl_c = task::spawn(crate::signal::ctrl_c()); assert_pending!(ctrl_c.poll()); // Windows doesn't have a good programmatic way of sending...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
9255d96b1b5d6ac85e348d718ed69ea2f80b585c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9255d96b1b5d6ac85e348d718ed69ea2f80b585c/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVEN...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
a27575f284fdbd14b750f694d70c716d8c7ddf90
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a27575f284fdbd14b750f694d70c716d8c7ddf90/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVEN...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
ctrl_logoff: EventInfo, ctrl_shutdown: EventInfo, } impl Init for OsStorage { fn init() -> Self { Self { ctrl_break: Default::default(), ctrl_close: Default::default(), ctrl_c: Default::default(), ctrl_logoff: Default::default(), ctrl_shutdown...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
#[derive(Debug)] pub(crate) struct OsExtraData {} impl Init for OsExtraData { fn init() -> Self { Self {} } } fn global_init() -> io::Result<()> { static INIT: Once = Once::new(); let mut init = None; INIT.call_once(|| unsafe { let rc = console::SetConsoleCtrlHandler(Some(handler...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
// let the OS fire the next (possibly the default) handler. 0 } } #[cfg(all(test, not(loom)))] mod tests { use super::*; use crate::runtime::Runtime; use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task}; #[test] fn ctrl_c() { let rt = rt(); let _enter = r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
// integration and test that our handling works. unsafe { super::handler(console::CTRL_BREAK_EVENT); } ctrl_break.recv().await.unwrap(); }); } #[test] fn ctrl_close() { let rt = rt(); rt.block_on(async { let mut ctrl_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
ctrl_shutdown.recv().await.unwrap(); }); } #[test] fn ctrl_logoff() { let rt = rt(); rt.block_on(async { let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()); // Windows doesn't have a good programmatic way of sending events /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
0c8e8248f8de281f22ad6f30b967053f44fff66e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/src/signal/windows/sys.rs
201
229
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::convert::TryFrom; use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
ctrl_c: EventInfo, ctrl_logoff: EventInfo, ctrl_shutdown: EventInfo, } impl Init for OsStorage { fn init() -> Self { Self { ctrl_break: Default::default(), ctrl_close: Default::default(), ctrl_c: Default::default(), ctrl_logoff: Default::default(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
#[derive(Debug)] pub(crate) struct OsExtraData {} impl Init for OsExtraData { fn init() -> Self { Self {} } } fn global_init() -> io::Result<()> { static INIT: Once = Once::new(); let mut init = None; INIT.call_once(|| unsafe { let rc = console::SetConsoleCtrlHandler(Some(handler...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
// No one is listening for this notification any more // let the OS fire the next (possibly the default) handler. 0 } } #[cfg(all(test, not(loom)))] mod tests { use super::*; use crate::runtime::Runtime; use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task}; #[test] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
// like sending signals on Unix, so we'll stub out the actual OS // integration and test that our handling works. unsafe { super::handler(console::CTRL_BREAK_EVENT); } ctrl_break.recv().await.unwrap(); }); } #[test] fn ctrl_close() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
} ctrl_shutdown.recv().await.unwrap(); }); } #[test] fn ctrl_logoff() { let rt = rt(); rt.block_on(async { let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()); // Windows doesn't have a good programmatic way of sending event...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
299bd6aee3f0ff30a719b327759c088a10813ac8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/src/signal/windows/sys.rs
201
230
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::convert::TryFrom; use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE}; use winapi::um::consoleapi::SetConsoleCtrlHandler; use winapi::um::wincon; pub(super) fn ctrl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
ctrl_close: EventInfo, ctrl_c: EventInfo, ctrl_logoff: EventInfo, ctrl_shutdown: EventInfo, } impl Init for OsStorage { fn init() -> Self { Self { ctrl_break: Default::default(), ctrl_close: Default::default(), ctrl_c: Default::default(), ctrl_log...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
} #[derive(Debug)] pub(crate) struct OsExtraData {} impl Init for OsExtraData { fn init() -> Self { Self {} } } fn global_init() -> io::Result<()> { static INIT: Once = Once::new(); let mut init = None; INIT.call_once(|| unsafe { let rc = SetConsoleCtrlHandler(Some(handler), TRU...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
} else { // No one is listening for this notification any more // let the OS fire the next (possibly the default) handler. FALSE } } #[cfg(all(test, not(loom)))] mod tests { use super::*; use crate::runtime::Runtime; use tokio_test::{assert_ok, assert_pending, assert_ready_ok, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
121
180
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:5
// Windows doesn't have a good programmatic way of sending events // like sending signals on Unix, so we'll stub out the actual OS // integration and test that our handling works. unsafe { super::handler(wincon::CTRL_BREAK_EVENT); } ctrl_break...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
161
220
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:6
super::handler(wincon::CTRL_SHUTDOWN_EVENT); } ctrl_shutdown.recv().await.unwrap(); }); } #[test] fn ctrl_logoff() { let rt = rt(); rt.block_on(async { let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff()); // Wind...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
01ebb0aa295956c3acf894127207d14ec628ada3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/01ebb0aa295956c3acf894127207d14ec628ada3/tokio/src/signal/windows/sys.rs
201
231
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1
use std::convert::TryFrom; use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Init, Storage}; use crate::signal::RxFuture; use winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE}; use winapi::um::consoleapi::SetConsoleCtrlHandler; use winapi::um::wincon::{CTRL_BREAK_EVENT, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
69a6585429d17701a87aa914500d9c11e88c663f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69a6585429d17701a87aa914500d9c11e88c663f/tokio/src/signal/windows/sys.rs
1
60
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2
impl Storage for OsStorage { fn event_info(&self, id: EventId) -> Option<&EventInfo> { match DWORD::try_from(id) { Ok(CTRL_C_EVENT) => Some(&self.ctrl_c), Ok(CTRL_BREAK_EVENT) => Some(&self.ctrl_break), _ => None, } } fn for_each<'a, F>(&'a self, mut f: F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
69a6585429d17701a87aa914500d9c11e88c663f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69a6585429d17701a87aa914500d9c11e88c663f/tokio/src/signal/windows/sys.rs
41
100
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3
init = Some(ret); }); init.unwrap_or_else(|| Ok(())) } unsafe extern "system" fn handler(ty: DWORD) -> BOOL { let globals = globals(); globals.record_event(ty as EventId); // According to https://docs.microsoft.com/en-us/windows/console/handlerroutine // the handler routine is always invoked ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
69a6585429d17701a87aa914500d9c11e88c663f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69a6585429d17701a87aa914500d9c11e88c663f/tokio/src/signal/windows/sys.rs
81
140
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:4
// like sending signals on Unix, so we'll stub out the actual OS // integration and test that our handling works. unsafe { super::handler(CTRL_C_EVENT); } assert_ready_ok!(ctrl_c.poll()); } #[test] fn ctrl_break() { let rt = rt(); rt.block_on(as...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/windows/sys.rs
MIT
69a6585429d17701a87aa914500d9c11e88c663f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69a6585429d17701a87aa914500d9c11e88c663f/tokio/src/signal/windows/sys.rs
121
153
tokio-rs/tokio:tokio/src/stream.rs:1
//! A sequence of asynchronous values. #[cfg(feature = "time")] use std::time::Duration; #[cfg(feature = "time")] use crate::time::{throttle::Throttle, Timeout}; #[doc(inline)] pub use futures_core::Stream; #[doc(inline)] pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfold}; /// An ex...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
7e35922a1d282b1e3dadf037cd237be336b331fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7e35922a1d282b1e3dadf037cd237be336b331fb/tokio/src/stream.rs
1
60
tokio-rs/tokio:tokio/src/stream.rs:2
/// /// This combinator creates a new stream which wraps the receiving stream /// with a timeout. For each item, the returned stream is allowed to execute /// until it completes or `timeout` has elapsed, whichever happens first. /// /// If an item completes before `timeout` then the stream will yiel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
7e35922a1d282b1e3dadf037cd237be336b331fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7e35922a1d282b1e3dadf037cd237be336b331fb/tokio/src/stream.rs
41
78
tokio-rs/tokio:tokio/src/stream.rs:1
//! A sequence of asynchronous values. #[cfg(feature = "timer")] use std::time::Duration; #[cfg(feature = "timer")] use crate::timer::{throttle::Throttle, Timeout}; #[doc(inline)] pub use futures_core::Stream; #[doc(inline)] pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfold}; /// An...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/stream.rs
1
60
tokio-rs/tokio:tokio/src/stream.rs:2
/// /// This combinator creates a new stream which wraps the receiving stream /// with a timeout. For each item, the returned stream is allowed to execute /// until it completes or `timeout` has elapsed, whichever happens first. /// /// If an item completes before `timeout` then the stream will yiel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/stream.rs
41
78
tokio-rs/tokio:tokio/src/stream.rs:1
//! A sequence of asynchronous values. #[cfg(feature = "timer")] use std::time::Duration; #[cfg(feature = "timer")] use tokio_timer::{throttle::Throttle, Timeout}; #[doc(inline)] pub use futures_core::Stream; #[doc(inline)] pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfold}; /// An ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
a791f4a758604768463d3ca2162b913dcea34c40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/src/stream.rs
1
60
tokio-rs/tokio:tokio/src/stream.rs:1
//! A sequence of asynchronous values. #[cfg(feature = "timer")] use std::time::Duration; #[cfg(feature = "timer")] use tokio_timer::{throttle::Throttle, Timeout}; #[doc(inline)] pub use futures_core::Stream; #[doc(inline)] pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfold}; /// An ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
68d5fcb8d154309ba5abeaf8f092835ff3fa7c52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/68d5fcb8d154309ba5abeaf8f092835ff3fa7c52/tokio/src/stream.rs
1
60
tokio-rs/tokio:tokio/src/stream.rs:2
/// /// This combinator creates a new stream which wraps the receiving stream /// with a timeout. For each item, the returned stream is allowed to execute /// until it completes or `timeout` has elapsed, whichever happens first. /// /// If an item completes before `timeout` then the stream will yiel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
68d5fcb8d154309ba5abeaf8f092835ff3fa7c52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/68d5fcb8d154309ba5abeaf8f092835ff3fa7c52/tokio/src/stream.rs
41
80
tokio-rs/tokio:tokio/src/stream.rs:1
//! A sequence of asynchronous values. #[cfg(feature = "timer")] use std::time::Duration; #[cfg(feature = "timer")] use tokio_timer::{throttle::Throttle, Timeout}; #[doc(inline)] pub use futures_core::Stream; #[doc(inline)] pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfold}; /// An ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
47e2ff48d9f1daac7dba9f136b24eed64c87cf40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/src/stream.rs
1
60
tokio-rs/tokio:tokio/src/stream.rs:2
/// This combinator creates a new stream which wraps the receiving stream /// with a timeout. For each item, the returned stream is allowed to execute /// until it completes or `timeout` has elapsed, whichever happens first. /// /// If an item completes before `timeout` then the stream will yield //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream.rs
MIT
47e2ff48d9f1daac7dba9f136b24eed64c87cf40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/src/stream.rs
41
79
tokio-rs/tokio:tokio/src/stream/all.rs:1
use crate::stream::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Future for the [`all`](super::StreamExt::all) method. #[derive(Debug)] #[must_use = "futures do nothing unless yo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/all.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/all.rs
1
55
tokio-rs/tokio:tokio/src/stream/all.rs:1
use crate::stream::Stream; use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; /// Future for the [`all`](super::StreamExt::all) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct AllFuture<'a, St: ?Sized, F> { stream: &'a mut St, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/all.rs
MIT
3cf91db4b6429c88a74428ac29b99d3b822f0790
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3cf91db4b6429c88a74428ac29b99d3b822f0790/tokio/src/stream/all.rs
1
45
tokio-rs/tokio:tokio/src/stream/any.rs:1
use crate::stream::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Future for the [`any`](super::StreamExt::any) method. #[derive(Debug)] #[must_use = "futures do nothing unless yo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/any.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/any.rs
1
55
tokio-rs/tokio:tokio/src/stream/any.rs:1
use crate::stream::Stream; use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; /// Future for the [`any`](super::StreamExt::any) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct AnyFuture<'a, St: ?Sized, F> { stream: &'a mut St, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/any.rs
MIT
3540c5b9ee23e29eb04bfefcf4500741555f2141
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3540c5b9ee23e29eb04bfefcf4500741555f2141/tokio/src/stream/any.rs
1
45
tokio-rs/tokio:tokio/src/stream/chain.rs:1
use crate::stream::{Fuse, Stream}; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`chain`](super::StreamExt::chain) method. pub struct Chain<T, U> { #[pin] a: Fuse<T>, #[pin] b: U, } } impl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/chain.rs
MIT
236629d1be7208612cbe5388e7ffebf85b73c157
github
async-runtime
https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/src/stream/chain.rs
1
49
tokio-rs/tokio:tokio/src/stream/chain.rs:1
use crate::stream::{Fuse, Stream}; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`chain`](super::StreamExt::chain) method. pub struct Chain<T, U> { #[pin] a: Fuse<T>, #[pin] b: U, } } impl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/chain.rs
MIT
7c3f1cb4a3d6076cb5e1aedf2311f62c8a7a2fd7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c3f1cb4a3d6076cb5e1aedf2311f62c8a7a2fd7/tokio/src/stream/chain.rs
1
57
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { /// Future returned by the [`collect`](super:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
aa171f2aa9593f64e78bde2c679a4c9bd9d9d163
github
async-runtime
https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/collect.rs:3
} } } // ===== FromStream implementations impl FromStream<()> for () {} impl sealed::FromStreamPriv<()> for () { type InternalCollection = (); fn initialize(_: sealed::Internal, _lower: usize, _upper: Option<usize>) {} fn extend(_: sealed::Internal, _collection: &mut (), _item: ()) -> bool { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
aa171f2aa9593f64e78bde2c679a4c9bd9d9d163
github
async-runtime
https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/src/stream/collect.rs
81
140
tokio-rs/tokio:tokio/src/stream/collect.rs:4
impl<T> sealed::FromStreamPriv<T> for Vec<T> { type InternalCollection = Vec<T>; fn initialize(_: sealed::Internal, lower: usize, _upper: Option<usize>) -> Vec<T> { Vec::with_capacity(lower) } fn extend(_: sealed::Internal, collection: &mut Vec<T>, item: T) -> bool { collection.push(it...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
aa171f2aa9593f64e78bde2c679a4c9bd9d9d163
github
async-runtime
https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/src/stream/collect.rs
121
180
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use bytes::{Buf, BufMut, Bytes, BytesMut}; use core::future::Future; use core::marker::PhantomPinned; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/collect.rs:3
} } } } // ===== FromStream implementations impl FromStream<()> for () {} impl sealed::FromStreamPriv<()> for () { type InternalCollection = (); fn initialize(_: sealed::Internal, _lower: usize, _upper: Option<usize>) {} fn extend(_: sealed::Internal, _collection: &mut (), _item: ()) -> boo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
81
140
tokio-rs/tokio:tokio/src/stream/collect.rs:4
impl<T> FromStream<T> for Vec<T> {} impl<T> sealed::FromStreamPriv<T> for Vec<T> { type InternalCollection = Vec<T>; fn initialize(_: sealed::Internal, lower: usize, _upper: Option<usize>) -> Vec<T> { Vec::with_capacity(lower) } fn extend(_: sealed::Internal, collection: &mut Vec<T>, item: T)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
121
180
tokio-rs/tokio:tokio/src/stream/collect.rs:5
impl<T, U, E> sealed::FromStreamPriv<Result<T, E>> for Result<U, E> where U: FromStream<T>, { type InternalCollection = Result<U::InternalCollection, E>; fn initialize( _: sealed::Internal, lower: usize, upper: Option<usize>, ) -> Result<U::InternalCollection, E> { Ok(U:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
161
220
tokio-rs/tokio:tokio/src/stream/collect.rs:6
} else { unreachable!(); } } } } impl<T: Buf> FromStream<T> for Bytes {} impl<T: Buf> sealed::FromStreamPriv<T> for Bytes { type InternalCollection = BytesMut; fn initialize(_: sealed::Internal, _lower: usize, _upper: Option<usize>) -> BytesMut { BytesMut::new(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
201
260
tokio-rs/tokio:tokio/src/stream/collect.rs:7
fn finalize(_: sealed::Internal, collection: &mut BytesMut) -> BytesMut { mem::replace(collection, BytesMut::new()) } } pub(crate) mod sealed { #[doc(hidden)] pub trait FromStreamPriv<T> { /// Intermediate type used during collection process /// /// The name of this type is ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/collect.rs
241
272
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use bytes::{Buf, BufMut, Bytes, BytesMut}; use core::future::Future; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { /// Future returned by the [`collec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/collect.rs:2
U: FromStream<T::Item>, { pub(super) fn new(stream: T) -> Collect<T, U> { let (lower, upper) = stream.size_hint(); let collection = U::initialize(sealed::Internal, lower, upper); Collect { stream, collection } } } impl<T, U> Future for Collect<T, U> where T: Stream, U: FromStre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
41
100
tokio-rs/tokio:tokio/src/stream/collect.rs:3
impl sealed::FromStreamPriv<()> for () { type InternalCollection = (); fn initialize(_: sealed::Internal, _lower: usize, _upper: Option<usize>) {} fn extend(_: sealed::Internal, _collection: &mut (), _item: ()) -> bool { true } fn finalize(_: sealed::Internal, _collection: &mut ()) {} } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
81
140
tokio-rs/tokio:tokio/src/stream/collect.rs:4
fn extend(_: sealed::Internal, collection: &mut Vec<T>, item: T) -> bool { collection.push(item); true } fn finalize(_: sealed::Internal, collection: &mut Vec<T>) -> Vec<T> { mem::replace(collection, vec![]) } } impl<T> FromStream<T> for Box<[T]> {} impl<T> sealed::FromStreamPriv<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
121
180
tokio-rs/tokio:tokio/src/stream/collect.rs:5
lower: usize, upper: Option<usize>, ) -> Result<U::InternalCollection, E> { Ok(U::initialize(sealed::Internal, lower, upper)) } fn extend( _: sealed::Internal, collection: &mut Self::InternalCollection, item: Result<T, E>, ) -> bool { assert!(collection.i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
161
220
tokio-rs/tokio:tokio/src/stream/collect.rs:6
impl<T: Buf> sealed::FromStreamPriv<T> for Bytes { type InternalCollection = BytesMut; fn initialize(_: sealed::Internal, _lower: usize, _upper: Option<usize>) -> BytesMut { BytesMut::new() } fn extend(_: sealed::Internal, collection: &mut BytesMut, item: T) -> bool { collection.put(it...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
201
260
tokio-rs/tokio:tokio/src/stream/collect.rs:7
/// Intermediate type used during collection process /// /// The name of this type is internal and cannot be relied upon. type InternalCollection; /// Initialize the collection fn initialize( internal: Internal, lower: usize, upper: Option<usi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40/tokio/src/stream/collect.rs
241
264
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use bytes::{Buf, BufMut, Bytes, BytesMut}; use core::future::Future; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { /// Future returned by the [`collec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/collect.rs:2
U: FromStream<T::Item>, { pub(super) fn new(stream: T) -> Collect<T, U> { let (lower, upper) = stream.size_hint(); let collection = U::initialize(lower, upper); Collect { stream, collection } } } impl<T, U> Future for Collect<T, U> where T: Stream, U: FromStream<T::Item>, { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
41
100
tokio-rs/tokio:tokio/src/stream/collect.rs:3
impl sealed::FromStreamPriv<()> for () { type Collection = (); fn initialize(_lower: usize, _upper: Option<usize>) {} fn extend(_collection: &mut (), _item: ()) -> bool { true } fn finalize(_collection: &mut ()) {} } impl<T: AsRef<str>> FromStream<T> for String {} impl<T: AsRef<str>> se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
81
140
tokio-rs/tokio:tokio/src/stream/collect.rs:4
fn extend(collection: &mut Vec<T>, item: T) -> bool { collection.push(item); true } fn finalize(collection: &mut Vec<T>) -> Vec<T> { mem::replace(collection, vec![]) } } impl<T> FromStream<T> for Box<[T]> {} impl<T> sealed::FromStreamPriv<T> for Box<[T]> { type Collection = Ve...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
121
180
tokio-rs/tokio:tokio/src/stream/collect.rs:5
fn extend(collection: &mut Self::Collection, item: Result<T, E>) -> bool { assert!(collection.is_ok()); match item { Ok(item) => { let collection = collection.as_mut().ok().expect("invalid state"); U::extend(collection, item) } Err(err)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
161
220
tokio-rs/tokio:tokio/src/stream/collect.rs:6
collection.put(item); true } fn finalize(collection: &mut BytesMut) -> Bytes { mem::replace(collection, BytesMut::new()).freeze() } } impl<T: Buf> FromStream<T> for BytesMut {} impl<T: Buf> sealed::FromStreamPriv<T> for BytesMut { type Collection = BytesMut; fn initialize(_lower:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
a23d2b2274fbcbf423bb85683db4a7556c568a24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a23d2b2274fbcbf423bb85683db4a7556c568a24/tokio/src/stream/collect.rs
201
246
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use bytes::{Buf, BufMut, Bytes, BytesMut}; use core::future::Future; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { /// Future returned by the [`collec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
476bf0084a7abb86ed2338095da4c7297453f00c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/collect.rs:1
use crate::stream::Stream; use bytes::{Buf, BufMut, Bytes, BytesMut}; use core::future::Future; use core::mem; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. pin_project! { /// Stream returned by the [`collec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/collect.rs
MIT
eb1a8e1792b2c4b296be47a0681421c90bbdbf7a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/eb1a8e1792b2c4b296be47a0681421c90bbdbf7a/tokio/src/stream/collect.rs
1
60
tokio-rs/tokio:tokio/src/stream/empty.rs:1
use crate::stream::Stream; use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`empty`](fn@empty) function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Empty<T>(PhantomData<T>); impl<T> Unpin for Empty<T> {} unsafe impl<T> Send for ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/empty.rs
MIT
b44ab273597d3757b5b50eed95c4f8890fa54e42
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b44ab273597d3757b5b50eed95c4f8890fa54e42/tokio/src/stream/empty.rs
1
50
tokio-rs/tokio:tokio/src/stream/empty.rs:1
use crate::stream::Stream; use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`empty`] function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Empty<T>(PhantomData<T>); impl<T> Unpin for Empty<T> {} unsafe impl<T> Send for Empty<T> {...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/empty.rs
MIT
7c1bc460f7eccbeef62504d4799b6bccc909e46c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c1bc460f7eccbeef62504d4799b6bccc909e46c/tokio/src/stream/empty.rs
1
50
tokio-rs/tokio:tokio/src/stream/empty.rs:1
use crate::stream::Stream; use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`empty`] function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Empty<T>(PhantomData<T>); impl<T> Unpin for Empty<T> {} /// Creates a stream that yields ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/empty.rs
MIT
8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f/tokio/src/stream/empty.rs
1
48
tokio-rs/tokio:tokio/src/stream/filter.rs:1
use crate::stream::Stream; use core::fmt; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`filter`](super::StreamExt::filter) method. #[must_use = "streams do nothing unless polled"] pub struct Filter<St, F> { #[pin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter.rs
MIT
a515f9c459d662b9c93d962812dc1fd8d1b32e08
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/filter.rs
1
58
tokio-rs/tokio:tokio/src/stream/filter.rs:1
use crate::stream::Stream; use core::fmt; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`filter`](super::StreamExt::filter) method. #[must_use = "streams do nothing unless polled"] pub struct Filter<St, F> { #[pin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter.rs
MIT
3b9c7b1715777b6db69d420c1530aa845e6306c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/filter.rs
1
60
tokio-rs/tokio:tokio/src/stream/filter.rs:2
St: Stream, F: FnMut(&St::Item) -> bool, { type Item = St::Item; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<St::Item>> { loop { match ready!(self.as_mut().project().stream.poll_next(cx)) { Some(e) => { if (self.as_mut(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter.rs
MIT
3b9c7b1715777b6db69d420c1530aa845e6306c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/filter.rs
41
62
tokio-rs/tokio:tokio/src/stream/filter_map.rs:1
use crate::stream::Stream; use core::fmt; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`filter_map`](super::StreamExt::filter_map) method. #[must_use = "streams do nothing unless polled"] pub struct FilterMap<St, F> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter_map.rs
MIT
a515f9c459d662b9c93d962812dc1fd8d1b32e08
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/filter_map.rs
1
58
tokio-rs/tokio:tokio/src/stream/filter_map.rs:1
use crate::stream::Stream; use core::fmt; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Stream returned by the [`filter_map`](super::StreamExt::filter_map) method. #[must_use = "streams do nothing unless polled"] pub struct FilterMap<St, F> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter_map.rs
MIT
3b9c7b1715777b6db69d420c1530aa845e6306c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/filter_map.rs
1
60
tokio-rs/tokio:tokio/src/stream/filter_map.rs:2
St: Stream, F: FnMut(St::Item) -> Option<T>, { type Item = T; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<T>> { loop { match ready!(self.as_mut().project().stream.poll_next(cx)) { Some(e) => { if let Some(e) = (self.as_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/filter_map.rs
MIT
3b9c7b1715777b6db69d420c1530aa845e6306c3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/filter_map.rs
41
62
tokio-rs/tokio:tokio/src/stream/fold.rs:1
use crate::stream::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Future returned by the [`fold`](super::StreamExt::fold) method. #[derive(Debug)] #[must_use = "futures do nothing...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/fold.rs
MIT
c23c1ecbcbd7ff8e1ee137f691eddad31aa39331
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/fold.rs
1
57
tokio-rs/tokio:tokio/src/stream/fold.rs:1
use crate::stream::Stream; use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; use pin_project_lite::pin_project; pin_project! { /// Future returned by the [`fold`](super::StreamExt::fold) method. #[derive(Debug)] pub struct FoldFuture<St, B, F> { #[pin] stream: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/fold.rs
MIT
0545b349e1fbf6663eb628cd4273c5baddf232fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0545b349e1fbf6663eb628cd4273c5baddf232fe/tokio/src/stream/fold.rs
1
51
tokio-rs/tokio:tokio/src/stream/fuse.rs:1
use crate::stream::Stream; use pin_project_lite::pin_project; use std::pin::Pin; use std::task::{Context, Poll}; pin_project! { /// Stream returned by [`fuse()`][super::StreamExt::fuse]. #[derive(Debug)] pub struct Fuse<T> { #[pin] stream: Option<T>, } } impl<T> Fuse<T> where T: S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/fuse.rs
MIT
cfd9b36d89e6b665c11248a86de8934cb4a7bdff
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cfd9b36d89e6b665c11248a86de8934cb4a7bdff/tokio/src/stream/fuse.rs
1
53
tokio-rs/tokio:tokio/src/stream/iter.rs:1
use crate::stream::Stream; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`iter`](fn@iter) function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Iter<I> { iter: I, } impl<I> Unpin for Iter<I> {} /// Converts an `Iterator` into a `Stream` which is always...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/iter.rs
MIT
9f63911adc5b809fd3df7cfbb736897a86895e0c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/stream/iter.rs
1
56
tokio-rs/tokio:tokio/src/stream/iter.rs:1
use crate::stream::Stream; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`iter`](fn@iter) function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Iter<I> { iter: I, } impl<I> Unpin for Iter<I> {} /// Converts an `Iterator` into a `Stream` which is always...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/iter.rs
MIT
b44ab273597d3757b5b50eed95c4f8890fa54e42
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b44ab273597d3757b5b50eed95c4f8890fa54e42/tokio/src/stream/iter.rs
1
55
tokio-rs/tokio:tokio/src/stream/iter.rs:1
use crate::stream::Stream; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`iter`] function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Iter<I> { iter: I, } impl<I> Unpin for Iter<I> {} /// Converts an `Iterator` into a `Stream` which is always ready //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/iter.rs
MIT
186196b911bb7cbbd67e74b4ef051d3daf2d64c1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/186196b911bb7cbbd67e74b4ef051d3daf2d64c1/tokio/src/stream/iter.rs
1
55
tokio-rs/tokio:tokio/src/stream/iter.rs:1
use crate::stream::Stream; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`iter`] function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Iter<I> { iter: I, } impl<I> Unpin for Iter<I> {} /// Converts an `Iterator` into a `Stream` which is always ready //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/iter.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/iter.rs
1
54
tokio-rs/tokio:tokio/src/stream/iter.rs:1
use crate::stream::Stream; use core::pin::Pin; use core::task::{Context, Poll}; /// Stream for the [`iter`] function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Iter<I> { iter: I, } impl<I> Unpin for Iter<I> {} /// Converts an `Iterator` into a `Stream` which is always ready //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/stream/iter.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/stream/iter.rs
1
52