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/stream/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 for the [`map`](super::StreamExt::map) method.
#[must_use = "streams do nothing unless polled"]
pub struct Map<St, F> {
#[pin]
stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/map.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/map.rs | 1 | 51 |
tokio-rs/tokio:tokio/src/stream/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 for the [`map`](super::StreamExt::map) method.
#[must_use = "streams do nothing unless polled"]
pub struct Map<St, F> {
#[pin]
stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/map.rs | MIT | 3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/map.rs | 1 | 55 |
tokio-rs/tokio:tokio/src/stream/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 for the [`map`](super::StreamExt::map) method.
#[must_use = "streams do nothing unless polled"]
pub struct Map<St, F> {
#[pin]
stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/map.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/stream/map.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/stream/merge.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 [`merge`](super::StreamExt::merge) method.
pub struct Merge<T, U> {
#[pin]
a: Fuse<T>,
#[pin]
b: Fuse<U>,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/merge.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/src/stream/merge.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/merge.rs:2 | let me = self.project();
let a_first = *me.a_first;
// Toggle the flag
*me.a_first = !a_first;
if a_first {
poll_next(me.a, me.b, cx)
} else {
poll_next(me.b, me.a, cx)
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
super::m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/merge.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/src/stream/merge.rs | 41 | 89 |
tokio-rs/tokio:tokio/src/stream/merge.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 [`merge`](super::StreamExt::merge) method.
pub struct Merge<T, U> {
#[pin]
a: Fuse<T>,
#[pin]
b: Fuse<U>,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/merge.rs | MIT | 0ba6e9abdbe1b42997d183adf5a39488c9543200 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ba6e9abdbe1b42997d183adf5a39488c9543200/tokio/src/stream/merge.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/merge.rs:2 | let me = self.project();
let a_first = *me.a_first;
// Toggle the flag
*me.a_first = !a_first;
if a_first {
poll_next(me.a, me.b, cx)
} else {
poll_next(me.b, me.a, cx)
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
let (a_l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/merge.rs | MIT | 0ba6e9abdbe1b42997d183adf5a39488c9543200 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ba6e9abdbe1b42997d183adf5a39488c9543200/tokio/src/stream/merge.rs | 41 | 97 |
tokio-rs/tokio:tokio/src/stream/merge.rs:3 | Ready(Some(val)) => return Ready(Some(val)),
Ready(None) => {}
Pending => done = false,
}
match second.poll_next(cx) {
Ready(Some(val)) => return Ready(Some(val)),
Ready(None) => {}
Pending => done = false,
}
if done {
Ready(None)
} else {
Pe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/merge.rs | MIT | 0ba6e9abdbe1b42997d183adf5a39488c9543200 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ba6e9abdbe1b42997d183adf5a39488c9543200/tokio/src/stream/merge.rs | 81 | 97 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
mod filter;
use filter::Filter;
mod filter_map;
use filter_map::FilterMap;
mod ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/mod.rs:4 | /// let mut stream = stream.map(|x| x + 3);
///
/// assert_eq!(stream.next().await, Some(4));
/// assert_eq!(stream.next().await, Some(5));
/// assert_eq!(stream.next().await, Some(6));
/// # }
/// ```
fn map<T, F>(self, f: F) -> Map<Self, F>
where
F: FnMut(Self::Item) -> T,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/stream/mod.rs:5 | /// assert_eq!(Some(6), evens.next().await);
/// assert_eq!(Some(8), evens.next().await);
/// assert_eq!(None, evens.next().await);
/// # }
/// ```
fn filter<F>(self, f: F) -> Filter<Self, F>
where
F: FnMut(&Self::Item) -> bool,
Self: Sized,
{
Filter::new(self, f)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/stream/mod.rs:7 | ///
/// This function, like `Iterator::take_while`, will take elements from the
/// stream until the predicate `f` resolves to `false`. Once one element
/// returns false it will always return that the stream is done.
///
/// # Examples
///
/// ```
/// # #[tokio::main]
/// # async fn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/mod.rs | 241 | 270 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
mod filter;
use filter::Filter;
mod filter_map;
use filter_map::FilterMap;
mod ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 101f770af33ae65820e1cc0e9b89d998b3c1317a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/101f770af33ae65820e1cc0e9b89d998b3c1317a/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/mod.rs:4 | /// assert_eq!(stream.next().await, Some(5));
/// assert_eq!(stream.next().await, Some(6));
/// # }
/// ```
fn map<T, F>(self, f: F) -> Map<Self, F>
where
F: FnMut(Self::Item) -> T,
Self: Sized,
{
Map::new(self, f)
}
/// Filters the values produced by this stream... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 101f770af33ae65820e1cc0e9b89d998b3c1317a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/101f770af33ae65820e1cc0e9b89d998b3c1317a/tokio/src/stream/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/stream/mod.rs:5 | /// # }
/// ```
fn filter<F>(self, f: F) -> Filter<Self, F>
where
F: FnMut(&Self::Item) -> bool,
Self: Sized,
{
Filter::new(self, f)
}
/// Filters the values produced by this stream while simultaneously mapping
/// them to a different type according to the provided c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 101f770af33ae65820e1cc0e9b89d998b3c1317a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/101f770af33ae65820e1cc0e9b89d998b3c1317a/tokio/src/stream/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/stream/mod.rs:6 | fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
where
F: FnMut(Self::Item) -> Option<T>,
Self: Sized,
{
FilterMap::new(self, f)
}
/// Creates a new stream of at most `n` items of the underlying stream.
///
/// Once `n` items have been yielded from this stream then ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 101f770af33ae65820e1cc0e9b89d998b3c1317a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/101f770af33ae65820e1cc0e9b89d998b3c1317a/tokio/src/stream/mod.rs | 201 | 237 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
mod filter;
use filter::Filter;
mod filter_map;
use filter_map::FilterMap;
mod ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/mod.rs:4 | /// ```
fn map<T, F>(self, f: F) -> Map<Self, F>
where
F: FnMut(Self::Item) -> T,
Self: Sized,
{
Map::new(self, f)
}
/// Filters the values produced by this stream according to the provided
/// predicate.
///
/// As values of this stream are made available, the p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61/tokio/src/stream/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/stream/mod.rs:5 | where
F: FnMut(&Self::Item) -> bool,
Self: Sized,
{
Filter::new(self, f)
}
/// Filters the values produced by this stream while simultaneously mapping
/// them to a different type according to the provided closure.
///
/// As values of this stream are made available, the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61/tokio/src/stream/mod.rs | 161 | 207 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
mod filter;
use filter::Filter;
mod filter_map;
use filter_map::FilterMap;
mod ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3b9c7b1715777b6db69d420c1530aa845e6306c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/mod.rs:3 | ///
/// let stream = stream::iter(1..=3);
/// let mut stream = stream.map(|x| x + 3);
///
/// assert_eq!(stream.next().await, Some(4));
/// assert_eq!(stream.next().await, Some(5));
/// assert_eq!(stream.next().await, Some(6));
/// # }
/// ```
fn map<T, F>(self, f: F) -> Map<Self, F>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3b9c7b1715777b6db69d420c1530aa845e6306c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/stream/mod.rs:4 | /// assert_eq!(Some(2), evens.next().await);
/// assert_eq!(Some(4), evens.next().await);
/// assert_eq!(Some(6), evens.next().await);
/// assert_eq!(Some(8), evens.next().await);
/// assert_eq!(None, evens.next().await);
/// # }
/// ```
fn filter<F>(self, f: F) -> Filter<Self, F>
where
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3b9c7b1715777b6db69d420c1530aa845e6306c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/mod.rs | 121 | 175 |
tokio-rs/tokio:tokio/src/stream/mod.rs:5 | /// assert_eq!(Some(7), evens.next().await);
/// assert_eq!(Some(9), evens.next().await);
/// assert_eq!(None, evens.next().await);
/// # }
/// ```
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
where
F: FnMut(Self::Item) -> Option<T>,
Self: Sized,
{
FilterMap:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3b9c7b1715777b6db69d420c1530aa845e6306c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b9c7b1715777b6db69d420c1530aa845e6306c3/tokio/src/stream/mod.rs | 161 | 175 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
mod iter;
pub use iter::{iter, Iter};
mod map;
use map::Map;
mod next;
use next... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/mod.rs:2 | /// use tokio::stream::{self, StreamExt};
///
/// let mut stream = stream::iter(1..=3);
///
/// assert_eq!(stream.next().await, Some(1));
/// assert_eq!(stream.next().await, Some(2));
/// assert_eq!(stream.next().await, Some(3));
/// assert_eq!(stream.next().await, None);
/// # }
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/mod.rs | 41 | 93 |
tokio-rs/tokio:tokio/src/stream/mod.rs:3 | /// assert_eq!(stream.next().await, Some(6));
/// # }
/// ```
fn map<T, F>(self, f: F) -> Map<Self, F>
where
F: FnMut(Self::Item) -> T,
Self: Sized,
{
Map::new(self, f)
}
}
impl<T: ?Sized> StreamExt for T where T: Stream {} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/mod.rs | 81 | 93 |
tokio-rs/tokio:tokio/src/stream/mod.rs:1 | //! Stream utilities for Tokio.
//!
//! `Stream`s are an asynchoronous version of standard library's Iterator.
//!
//! This module provides helpers to work with them.
mod iter;
pub use iter::{iter, Iter};
mod map;
use map::Map;
mod next;
use next::Next;
pub use futures_core::Stream;
/// An extension trait for `Str... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/mod.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/stream/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/next.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 [`next`](super::StreamExt::next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/next.rs | MIT | c23c1ecbcbd7ff8e1ee137f691eddad31aa39331 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/next.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/stream/next.rs:1 | use crate::stream::Stream;
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Future for the [`next`](super::StreamExt::next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Next<'a, St: ?Sized> {
stream: &'a mut St,
}
impl<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/next.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/next.rs | 1 | 28 |
tokio-rs/tokio:tokio/src/stream/next.rs:1 | use crate::stream::Stream;
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Future for the [`next`](super::StreamExt::next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Next<'a, St: ?Sized> {
stream: &'a mut St,
}
impl<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/next.rs | MIT | 3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/src/stream/next.rs | 1 | 28 |
tokio-rs/tokio:tokio/src/stream/next.rs:1 | use crate::stream::Stream;
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Future for the [`next`](super::StreamExt::next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Next<'a, St: ?Sized> {
stream: &'a mut St,
}
impl<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/next.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/stream/next.rs | 1 | 31 |
tokio-rs/tokio:tokio/src/stream/once.rs:1 | use crate::stream::{self, Iter, Stream};
use core::option;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`once`](fn@once) function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Once<T> {
iter: Iter<option::IntoIter<T>>,
}
impl<I> Unpin for Once<I> {}
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/once.rs | MIT | b44ab273597d3757b5b50eed95c4f8890fa54e42 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b44ab273597d3757b5b50eed95c4f8890fa54e42/tokio/src/stream/once.rs | 1 | 52 |
tokio-rs/tokio:tokio/src/stream/once.rs:1 | use crate::stream::{self, Iter, Stream};
use core::option;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`once`] function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Once<T> {
iter: Iter<option::IntoIter<T>>,
}
impl<I> Unpin for Once<I> {}
/// Creates... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/once.rs | MIT | 64d23899118dfc8f1d4d7a9b60c015e43260df80 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/64d23899118dfc8f1d4d7a9b60c015e43260df80/tokio/src/stream/once.rs | 1 | 52 |
tokio-rs/tokio:tokio/src/stream/pending.rs:1 | use crate::stream::Stream;
use core::marker::PhantomData;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`pending`](fn@pending) function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Pending<T>(PhantomData<T>);
impl<T> Unpin for Pending<T> {}
unsafe impl<T> S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/pending.rs | MIT | b44ab273597d3757b5b50eed95c4f8890fa54e42 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b44ab273597d3757b5b50eed95c4f8890fa54e42/tokio/src/stream/pending.rs | 1 | 54 |
tokio-rs/tokio:tokio/src/stream/pending.rs:1 | use crate::stream::Stream;
use core::marker::PhantomData;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`pending`] function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Pending<T>(PhantomData<T>);
impl<T> Unpin for Pending<T> {}
unsafe impl<T> Send for Pend... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/pending.rs | MIT | 7c1bc460f7eccbeef62504d4799b6bccc909e46c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c1bc460f7eccbeef62504d4799b6bccc909e46c/tokio/src/stream/pending.rs | 1 | 54 |
tokio-rs/tokio:tokio/src/stream/pending.rs:1 | use crate::stream::Stream;
use core::marker::PhantomData;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`pending`] function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Pending<T>(PhantomData<T>);
impl<T> Unpin for Pending<T> {}
/// Creates a stream that i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/pending.rs | MIT | 8ed209b6125cb85039f676f00a3ae1dee1e0b747 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ed209b6125cb85039f676f00a3ae1dee1e0b747/tokio/src/stream/pending.rs | 1 | 52 |
tokio-rs/tokio:tokio/src/stream/pending.rs:1 | use crate::stream::Stream;
use core::marker::PhantomData;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Stream for the [`pending`] function.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct Pending<T>(PhantomData<T>);
impl<T> Unpin for Pending<T> {}
/// Creates a stream that i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/pending.rs | MIT | 8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f/tokio/src/stream/pending.rs | 1 | 52 |
tokio-rs/tokio:tokio/src/stream/skip.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 for the [`skip`](super::StreamExt::skip) method.
#[must_use = "streams do nothing unless polled"]
pub struct Skip<St> {
#[pin]
stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/skip.rs | MIT | 1a5de2c79d9d825c367f7881646306fe7f9aaa0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1a5de2c79d9d825c367f7881646306fe7f9aaa0c/tokio/src/stream/skip.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/skip_while.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 for the [`skip_while`](super::StreamExt::skip_while) method.
#[must_use = "streams do nothing unless polled"]
pub struct SkipWhile<St, F> {
#[... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/skip_while.rs | MIT | 513671f8dece002191feb4f2b1a97bd66306350c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/513671f8dece002191feb4f2b1a97bd66306350c/tokio/src/stream/skip_while.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:11 | pub fn insert(&mut self, k: K, stream: V) -> Option<V>
where
K: Hash + Eq,
{
let ret = self.remove(&k);
self.entries.push((k, stream));
ret
}
/// Removes a key from the map, returning the stream at the key if the key was previously in the map.
///
/// The key ma... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 06c7e73e9941ae8d7f84e978b24cb2e0664453de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c7e73e9941ae8d7f84e978b24cb2e0664453de/tokio/src/stream/stream_map.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:12 | ///
/// The key may be any borrowed form of the map's key type, but `Hash` and
/// `Eq` on the borrowed form must match those for the key type.
///
/// # Examples
///
/// ```
/// use tokio::stream::{StreamMap, pending};
///
/// let mut map = StreamMap::new();
/// map.insert(1, pe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 06c7e73e9941ae8d7f84e978b24cb2e0664453de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c7e73e9941ae8d7f84e978b24cb2e0664453de/tokio/src/stream/stream_map.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:13 | for _ in 0..self.entries.len() {
let (_, stream) = &mut self.entries[idx];
match Pin::new(stream).poll_next(cx) {
Ready(Some(val)) => return Ready(Some((idx, val))),
Ready(None) => {
// Remove the entry
self.entries.swap_re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 06c7e73e9941ae8d7f84e978b24cb2e0664453de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c7e73e9941ae8d7f84e978b24cb2e0664453de/tokio/src/stream/stream_map.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:14 | impl<K, V> Stream for StreamMap<K, V>
where
K: Clone + Unpin,
V: Stream + Unpin,
{
type Item = (K, V::Item);
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if let Some((idx, val)) = ready!(self.poll_next_entry(cx)) {
let key = self.entries... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 06c7e73e9941ae8d7f84e978b24cb2e0664453de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c7e73e9941ae8d7f84e978b24cb2e0664453de/tokio/src/stream/stream_map.rs | 521 | 555 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:13 | for _ in 0..self.entries.len() {
let (_, stream) = &mut self.entries[idx];
match Pin::new(stream).poll_next(cx) {
Ready(Some(val)) => return Ready(Some((idx, val))),
Ready(None) => {
// Remove the entry
self.entries.swap_re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 3403be5e2ea81eb971f38c180dac729b21c30fa8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3403be5e2ea81eb971f38c180dac729b21c30fa8/tokio/src/stream/stream_map.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:14 | type Item = (K, V::Item);
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if let Some((idx, val)) = ready!(self.poll_next_entry(cx)) {
let key = self.entries[idx].0.clone();
Poll::Ready(Some((key, val)))
} else {
Poll::R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | 3403be5e2ea81eb971f38c180dac729b21c30fa8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3403be5e2ea81eb971f38c180dac729b21c30fa8/tokio/src/stream/stream_map.rs | 521 | 549 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:10 | ret
}
/// Removes a key from the map, returning the stream at the key if the key was previously in the map.
///
/// The key may be any borrowed form of the map's key type, but `Hash` and
/// `Eq` on the borrowed form must match those for the key type.
///
/// # Examples
///
/// ```
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/stream/stream_map.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:11 | /// ```
/// use tokio::stream::{StreamMap, pending};
///
/// let mut map = StreamMap::new();
/// map.insert(1, pending::<i32>());
/// assert_eq!(map.contains_key(&1), true);
/// assert_eq!(map.contains_key(&2), false);
/// ```
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
wher... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/stream/stream_map.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:12 | Ready(None) => {
// Remove the entry
self.entries.swap_remove(idx);
// Check if this was the last entry, if so the cursor needs
// to wrap
if idx == self.entries.len() {
idx = 0;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/stream/stream_map.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/stream/stream_map.rs:13 | } else {
Poll::Ready(None)
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
let mut ret = (0, Some(0));
for (_, stream) in &self.entries {
let hint = stream.size_hint();
ret.0 += hint.0;
match (ret.1, hint.1) {
(Some(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/stream_map.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/stream/stream_map.rs | 481 | 503 |
tokio-rs/tokio:tokio/src/stream/take.rs:1 | use crate::stream::Stream;
use core::cmp;
use core::fmt;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
pin_project! {
/// Stream for the [`take`](super::StreamExt::take) method.
#[must_use = "streams do nothing unless polled"]
pub struct Take<St> {
#[pin]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/take.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/take.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/take.rs:2 | fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if *self.as_mut().project().remaining > 0 {
self.as_mut().project().stream.poll_next(cx).map(|ready| {
match &ready {
Some(_) => {
*self.as_mut().pro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/take.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/take.rs | 41 | 76 |
tokio-rs/tokio:tokio/src/stream/take.rs:1 | use crate::stream::Stream;
use core::cmp;
use core::fmt;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
pin_project! {
/// Stream for the [`map`](super::StreamExt::map) method.
#[must_use = "streams do nothing unless polled"]
pub struct Take<St> {
#[pin]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/take.rs | MIT | 101f770af33ae65820e1cc0e9b89d998b3c1317a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/101f770af33ae65820e1cc0e9b89d998b3c1317a/tokio/src/stream/take.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/take_while.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 for the [`take_while`](super::StreamExt::take_while) method.
#[must_use = "streams do nothing unless polled"]
pub struct TakeWhile<St, F> {
#[... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/take_while.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/take_while.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/take_while.rs:2 | impl<St, F> Stream for TakeWhile<St, F>
where
St: Stream,
F: FnMut(&St::Item) -> bool,
{
type Item = St::Item;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if !*self.as_mut().project().done {
self.as_mut().project().stream.poll_next(cx).... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/take_while.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/take_while.rs | 41 | 79 |
tokio-rs/tokio:tokio/src/stream/throttle.rs:1 | //! Slow down a stream by enforcing a delay between items.
use crate::stream::Stream;
use crate::time::{Duration, Instant, Sleep};
use std::future::Future;
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{self, Poll};
use pin_project_lite::pin_project;
pub(super) fn throttle<T>(duration: Duration, stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/throttle.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/stream/throttle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/throttle.rs:2 | has_delayed: bool,
// The stream to throttle
#[pin]
stream: T,
}
}
// XXX: are these safe if `T: !Unpin`?
impl<T: Unpin> Throttle<T> {
/// Acquires a reference to the underlying stream that this combinator is
/// pulling from.
pub fn get_ref(&self) -> &T {
&self.stream
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/throttle.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/stream/throttle.rs | 41 | 97 |
tokio-rs/tokio:tokio/src/stream/throttle.rs:3 | *self.as_mut().project().has_delayed = true;
}
let value = ready!(self.as_mut().project().stream.poll_next(cx));
if value.is_some() {
let dur = self.duration;
if let Some(ref mut delay) = self.as_mut().project().delay {
delay.reset(Instant::now() + dur);... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/throttle.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/stream/throttle.rs | 81 | 97 |
tokio-rs/tokio:tokio/src/stream/throttle.rs:1 | //! Slow down a stream by enforcing a delay between items.
use crate::stream::Stream;
use crate::time::{Duration, Instant, Sleep};
use std::future::Future;
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{self, Poll};
use pin_project_lite::pin_project;
pub(super) fn throttle<T>(duration: Duration, stream:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/throttle.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/stream/throttle.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/timeout.rs:1 | use crate::stream::{Fuse, Stream};
use crate::time::{error::Elapsed, Instant, Sleep};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
use std::time::Duration;
pin_project! {
/// Stream returned by the [`timeout`](super::StreamExt::timeout) method.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/timeout.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/stream/timeout.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/timeout.rs:2 | match self.as_mut().project().stream.poll_next(cx) {
Poll::Ready(v) => {
if v.is_some() {
let next = Instant::now() + self.duration;
self.as_mut().project().deadline.reset(next);
*self.as_mut().project().poll_deadline = true;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/timeout.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/src/stream/timeout.rs | 41 | 65 |
tokio-rs/tokio:tokio/src/stream/timeout.rs:1 | use crate::stream::{Fuse, Stream};
use crate::time::{error::Elapsed, Instant, Sleep};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
use std::time::Duration;
pin_project! {
/// Stream returned by the [`timeout`](super::StreamExt::timeout) method.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/timeout.rs | MIT | 0893841f31542b2b04c5050a8a4a3c45cf867e55 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0893841f31542b2b04c5050a8a4a3c45cf867e55/tokio/src/stream/timeout.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/timeout.rs:1 | use crate::stream::{Fuse, Stream};
use crate::time::{Elapsed, Instant, Sleep};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
use std::time::Duration;
pin_project! {
/// Stream returned by the [`timeout`](super::StreamExt::timeout) method.
#[m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/timeout.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/src/stream/timeout.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/timeout.rs:1 | use crate::stream::{Fuse, Stream};
use crate::time::{Delay, Elapsed, Instant};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use pin_project_lite::pin_project;
use std::time::Duration;
pin_project! {
/// Stream returned by the [`timeout`](super::StreamExt::timeout) method.
#[m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/timeout.rs | MIT | 12be90e3fff4041ea6398fc8cd834c3ec173bce5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/src/stream/timeout.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/stream/try_next.rs:1 | use crate::stream::{Next, 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 [`try_next`](super::StreamExt::try_next) method.
#[derive(Debug)]
#[must_use = "futures do... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/try_next.rs | MIT | c23c1ecbcbd7ff8e1ee137f691eddad31aa39331 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c23c1ecbcbd7ff8e1ee137f691eddad31aa39331/tokio/src/stream/try_next.rs | 1 | 38 |
tokio-rs/tokio:tokio/src/stream/try_next.rs:1 | use crate::stream::{Next, Stream};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Future for the [`try_next`](super::StreamExt::try_next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct TryNext<'a, St: ?Sized> {
inner: Nex... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/try_next.rs | MIT | a515f9c459d662b9c93d962812dc1fd8d1b32e08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a515f9c459d662b9c93d962812dc1fd8d1b32e08/tokio/src/stream/try_next.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/stream/try_next.rs:1 | use crate::stream::{Next, Stream};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
/// Future for the [`try_next`](super::StreamExt::try_next) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct TryNext<'a, St: ?Sized> {
inner: Nex... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/stream/try_next.rs | MIT | 3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3dcd76a38feff3188e1a94f39c4f5feaaa5bdf61/tokio/src/stream/try_next.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::loom::sync::Mutex;
use crate::sync::watch;
#[cfg(all(tokio_unstable, feature = "tracing"))]
use crate::util::trace;
/// A barrier enables multiple tasks to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main(flavor = "current_thread")]
/// # async fn main() {
/// use tokio::sync::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | #[derive(Debug)]
pub struct Barrier {
state: Mutex<BarrierState>,
wait: watch::Receiver<usize>,
n: usize,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: tracing::Span,
}
#[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usiz... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.file = location.file(),
loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | ///
/// # Cancel safety
///
/// This method is not cancel safe.
pub async fn wait(&self) -> BarrierWaitResult {
#[cfg(all(tokio_unstable, feature = "tracing"))]
return trace::async_op(
|| self.wait_internal(),
self.resource_span.clone(),
"Barrier::wait... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:5 | target: "runtime::resource::async_op::state_update",
arrived = true,
);
if state.arrived == self.n {
#[cfg(all(tokio_unstable, feature = "tracing"))]
tracing::trace!(
target: "runtime::resource::async_op::state_update",
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 161 | 213 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:6 | /// A `BarrierWaitResult` is returned by `wait` when all tasks in the `Barrier` have rendezvoused.
#[derive(Debug, Clone)]
pub struct BarrierWaitResult(bool);
impl BarrierWaitResult {
/// Returns `true` if this task from wait is the "leader task".
///
/// Only one task will have `true` returned from their ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/barrier.rs | 201 | 213 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::loom::sync::Mutex;
use crate::sync::watch;
#[cfg(all(tokio_unstable, feature = "tracing"))]
use crate::util::trace;
/// A barrier enables multiple tasks to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
/// # async fn main() {
/// use tokio::sync::Barrier;
/// use std::sync:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 5ba12a71451c00e9e220ec87ff869394acac2603 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5ba12a71451c00e9e220ec87ff869394acac2603/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.file = location.file(),
loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | pub async fn wait(&self) -> BarrierWaitResult {
#[cfg(all(tokio_unstable, feature = "tracing"))]
return trace::async_op(
|| self.wait_internal(),
self.resource_span.clone(),
"Barrier::wait",
"poll",
false,
)
.await;
#[c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/barrier.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:5 | #[cfg(all(tokio_unstable, feature = "tracing"))]
tracing::trace!(
target: "runtime::resource::async_op::state_update",
is_leader = true,
);
// we are the leader for this generation
// wake everyone, increment the gen... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/barrier.rs | 161 | 209 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | #[derive(Debug)]
pub struct Barrier {
state: Mutex<BarrierState>,
wait: watch::Receiver<usize>,
n: usize,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: tracing::Span,
}
#[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usiz... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/barrier.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
tracing::trace!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | #[cfg(all(tokio_unstable, feature = "tracing"))]
return trace::async_op(
|| self.wait_internal(),
self.resource_span.clone(),
"Barrier::wait",
"poll",
false,
)
.await;
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/barrier.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:5 | tracing::trace!(
target: "runtime::resource::async_op::state_update",
is_leader = true,
);
// we are the leader for this generation
// wake everyone, increment the generation, and return
state
.wa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/barrier.rs | 161 | 208 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
tracing::trace!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | f26ce08f37d8c8426736412f7aca51f4f39d43d3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | #[cfg(all(tokio_unstable, feature = "tracing"))]
return trace::async_op(
|| self.wait_internal(),
self.resource_span.clone(),
"Barrier::wait",
"poll",
false,
)
.await;
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | f26ce08f37d8c8426736412f7aca51f4f39d43d3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/barrier.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:5 | is_leader = true,
);
// we are the leader for this generation
// wake everyone, increment the generation, and return
state
.waker
.send(state.generation)
.expect("there is at least one receiver");... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | f26ce08f37d8c8426736412f7aca51f4f39d43d3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/barrier.rs | 161 | 206 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
tracing::trace!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | dee26c92ddb32e23acb0c1587e775ddab29e07f9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | #[cfg(all(tokio_unstable, feature = "tracing"))]
return trace::async_op(
|| self.wait_internal(),
self.resource_span.clone(),
"Barrier::wait",
"poll",
false,
)
.await;
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | dee26c92ddb32e23acb0c1587e775ddab29e07f9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/src/sync/barrier.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | loc.line = location.line(),
loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
size = n,
);
tracing::trace!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 4e3268d222423e874f5bbfa67e20f773da3c025f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::loom::sync::Mutex;
use crate::sync::watch;
/// A barrier enables multiple tasks to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
/// # async fn main() {
/// use tokio::sync::Barrier;
/// use std::sync::Arc;
///
/// let mut handles = Vec::with_capacity(10);
/// let barrier =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 549e89e9cd2073ffa70f1bd12022c5543343be78 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/549e89e9cd2073ffa70f1bd12022c5543343be78/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | state: Mutex<BarrierState>,
wait: watch::Receiver<usize>,
n: usize,
}
#[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usize,
}
impl Barrier {
/// Creates a new barrier that can block a given number of tasks.
///
/// A barrier will block `... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 549e89e9cd2073ffa70f1bd12022c5543343be78 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/549e89e9cd2073ffa70f1bd12022c5543343be78/tokio/src/sync/barrier.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | /// Barriers are re-usable after all tasks have rendezvoused once, and can
/// be used continuously.
///
/// A single (arbitrary) future will receive a [`BarrierWaitResult`] that returns `true` from
/// [`BarrierWaitResult::is_leader`] when returning from this function, and all other tasks
/// will ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 549e89e9cd2073ffa70f1bd12022c5543343be78 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/549e89e9cd2073ffa70f1bd12022c5543343be78/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | // immediately, since we cloned a receiver that has never seen any values.
if *wait.borrow() >= generation {
break;
}
}
BarrierWaitResult(false)
}
}
/// A `BarrierWaitResult` is returned by `wait` when all tasks in the `Barrier` have rendezvoused.
#[derive(D... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 549e89e9cd2073ffa70f1bd12022c5543343be78 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/549e89e9cd2073ffa70f1bd12022c5543343be78/tokio/src/sync/barrier.rs | 121 | 143 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::sync::watch;
use std::sync::Mutex;
/// A barrier enables multiple tasks to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
/// # async fn main() {
/// use tokio::sync::Barrier;
/// use std::sync::Arc;
///
/// let mut handles = Vec::with_capacity(10);
/// let barrier = Arc::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | d846bf24b1e1c825efb2a139ffe4882cb8aeb6de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d846bf24b1e1c825efb2a139ffe4882cb8aeb6de/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | pub struct Barrier {
state: Mutex<BarrierState>,
wait: watch::Receiver<usize>,
n: usize,
}
#[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usize,
}
impl Barrier {
/// Creates a new barrier that can block a given number of tasks.
///
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | d846bf24b1e1c825efb2a139ffe4882cb8aeb6de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d846bf24b1e1c825efb2a139ffe4882cb8aeb6de/tokio/src/sync/barrier.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | ///
/// Barriers are re-usable after all tasks have rendezvoused once, and can
/// be used continuously.
///
/// A single (arbitrary) future will receive a [`BarrierWaitResult`] that returns `true` from
/// [`BarrierWaitResult::is_leader`] when returning from this function, and all other tasks
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | d846bf24b1e1c825efb2a139ffe4882cb8aeb6de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d846bf24b1e1c825efb2a139ffe4882cb8aeb6de/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | // note that the first time through the loop, this _will_ yield a generation
// immediately, since we cloned a receiver that has never seen any values.
if *wait.borrow() >= generation {
break;
}
}
BarrierWaitResult(false)
}
}
/// A `BarrierWaitRe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | d846bf24b1e1c825efb2a139ffe4882cb8aeb6de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d846bf24b1e1c825efb2a139ffe4882cb8aeb6de/tokio/src/sync/barrier.rs | 121 | 144 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::sync::watch;
use std::sync::Mutex;
/// A barrier enables multiple threads to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
/// # async fn main() {
/// use tokio::sync::Barrier;
/// use std::sync::Arc;
///
/// let mut handles = Vec::with_capacity(10);
/// let barrier = Arc:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 4099bfdef05f514d4ca25cf15a58b12e2c53fdc1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4099bfdef05f514d4ca25cf15a58b12e2c53fdc1/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | pub struct Barrier {
state: Mutex<BarrierState>,
wait: watch::Receiver<usize>,
n: usize,
}
#[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usize,
}
impl Barrier {
/// Creates a new barrier that can block a given number of threads.
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 4099bfdef05f514d4ca25cf15a58b12e2c53fdc1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4099bfdef05f514d4ca25cf15a58b12e2c53fdc1/tokio/src/sync/barrier.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:3 | ///
/// Barriers are re-usable after all threads have rendezvoused once, and can
/// be used continuously.
///
/// A single (arbitrary) future will receive a [`BarrierWaitResult`] that returns `true` from
/// [`BarrierWaitResult::is_leader`] when returning from this function, and all other threads
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 4099bfdef05f514d4ca25cf15a58b12e2c53fdc1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4099bfdef05f514d4ca25cf15a58b12e2c53fdc1/tokio/src/sync/barrier.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:4 | // note that the first time through the loop, this _will_ yield a generation
// immediately, since we cloned a receiver that has never seen any values.
if *wait.borrow() >= generation {
break;
}
}
BarrierWaitResult(false)
}
}
/// A `BarrierWaitRe... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 4099bfdef05f514d4ca25cf15a58b12e2c53fdc1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4099bfdef05f514d4ca25cf15a58b12e2c53fdc1/tokio/src/sync/barrier.rs | 121 | 144 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:1 | use crate::sync::watch;
use std::sync::Mutex;
/// A barrier enables multiple threads to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
/// # async fn main() {
/// use tokio::sync::Barrier;
///
/// use futures::future::join_all;
/// use std::sync::Arc;
///
/// let mut handles = Vec::wi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 2bc9a4815259c8ff4daa5e24f128ec826970d17f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2bc9a4815259c8ff4daa5e24f128ec826970d17f/tokio/src/sync/barrier.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/barrier.rs:2 | #[derive(Debug)]
struct BarrierState {
waker: watch::Sender<usize>,
arrived: usize,
generation: usize,
}
impl Barrier {
/// Creates a new barrier that can block a given number of threads.
///
/// A barrier will block `n`-1 threads which call [`Barrier::wait`] and then wake up all
/// thread... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/barrier.rs | MIT | 2bc9a4815259c8ff4daa5e24f128ec826970d17f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2bc9a4815259c8ff4daa5e24f128ec826970d17f/tokio/src/sync/barrier.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.