Files
base64
bitflags
bytes
buf
fmt
case
cfg_if
derive_error
encoding_rs
fnv
foreign_types
foreign_types_shared
form_urlencoded
futures_channel
futures_core
futures_sink
futures_task
futures_util
future
stream
stream
try_stream
task
h2
codec
frame
hpack
proto
hashbrown
http
http_body
httparse
httpdate
hyper
body
client
common
proto
service
hyper_tls
idna
indexmap
instant
ipnet
itoa
lazy_static
libc
unix
lock_api
log
matches
memchr
mime
mio
event
net
sys
native_tls
num_cpus
once_cell
openssl
openssl_probe
openssl_sys
parking_lot
parking_lot_core
percent_encoding
pin_project
pin_project_internal
pin_project_lite
pin_utils
proc_macro2
rapr
reqwest
ryu
scopeguard
serde
de
private
ser
serde_json
serde_urlencoded
signal_hook_registry
slab
smallvec
socket2
tinyvec
tinyvec_macros
tokio
fs
future
io
driver
util
async_buf_read_ext.rsasync_read_ext.rsasync_seek_ext.rsasync_write_ext.rsbuf_reader.rsbuf_stream.rsbuf_writer.rschain.rscopy.rscopy_buf.rsempty.rsflush.rslines.rsmem.rsmod.rsread.rsread_buf.rsread_exact.rsread_int.rsread_line.rsread_to_end.rsread_to_string.rsread_until.rsrepeat.rsshutdown.rssink.rssplit.rstake.rsvec_with_initialized.rswrite.rswrite_all.rswrite_buf.rswrite_int.rs
loom
std
macros
net
tcp
unix
park
process
runtime
blocking
task
thread_pool
signal
sync
mpsc
rwlock
task
task
time
util
tokio_macros
tokio_native_tls
tokio_util
codec
sync
tower_service
tracing
tracing_core
try_lock
unicode_bidi
unicode_normalization
url
want
>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
use core::pin::Pin; use pin_project_lite::pin_project; pin_project! { /// UnfoldState used for stream and sink unfolds #[project = UnfoldStateProj] #[project_replace = UnfoldStateProjReplace] #[derive(Debug)] pub(crate) enum UnfoldState<T, R> { Value { value: T, }, Future { #[pin] future: R, }, Empty, } } impl<T, R> UnfoldState<T, R> { pub(crate) fn project_future(self: Pin<&mut Self>) -> Option<Pin<&mut R>> { match self.project() { UnfoldStateProj::Future { future } => Some(future), _ => None, } } pub(crate) fn take_value(self: Pin<&mut Self>) -> Option<T> { match &*self { UnfoldState::Value { .. } => match self.project_replace(UnfoldState::Empty) { UnfoldStateProjReplace::Value { value } => Some(value), _ => unreachable!(), }, _ => None, } } }