Movatterモバイル変換


[0]ホーム

URL:


ready

std::task

Macroready 

1.64.0 ·Source
pub macro ready($e:expr) {    ...}
Expand description

Extracts the successful type of aPoll<T>.

This macro bakes in propagation ofPending signals by returning early.

§Examples

usestd::task::{ready, Context, Poll};usestd::future::{self, Future};usestd::pin::Pin;pub fndo_poll(cx:&mutContext<'_>) -> Poll<()> {letmutfut = future::ready(42);letfut = Pin::new(&mutfut);letnum =ready!(fut.poll(cx));// ... use numPoll::Ready(())}

Theready! call expands to:

letnum =matchfut.poll(cx) {    Poll::Ready(t) => t,    Poll::Pending =>returnPoll::Pending,};

[8]ページ先頭

©2009-2026 Movatter.jp