@@ -529,7 +529,7 @@ impl CancellationTokenState {
529529/// A token which can be used to signal a cancellation request to one or more
530530/// tasks.
531531///
532- /// Tasks can call [`CancellationToken::wait_for_cancellation `] in order to
532+ /// Tasks can call [`CancellationToken::cancelled() `] in order to
533533/// obtain a Future which will be resolved when cancellation is requested.
534534///
535535/// Cancellation can be requested through the [`CancellationToken::cancel`] method.
@@ -548,7 +548,7 @@ impl CancellationTokenState {
548548/// let join_handle = tokio::spawn(async move {
549549/// // Wait for either cancellation or a very long time
550550/// select! {
551- /// _ = cloned_token.wait_for_cancellation () => {
551+ /// _ = cloned_token.cancelled () => {
552552/// // The token was cancelled
553553/// 5
554554/// }
@@ -672,7 +672,7 @@ impl CancellationToken {
672672 /// let join_handle = tokio::spawn(async move {
673673 /// // Wait for either cancellation or a very long time
674674 /// select! {
675- /// _ = child_token.wait_for_cancellation () => {
675+ /// _ = child_token.cancelled () => {
676676 /// // The token was cancelled
677677 /// 5
678678 /// }
@@ -778,8 +778,8 @@ impl CancellationToken {
778778 self . state ( ) . is_cancelled ( )
779779 }
780780
781- /// Returns a `Future` that gets fulfilled when cancellation is signalled .
782- pub fn wait_for_cancellation ( & self ) -> WaitForCancellationFuture < ' _ > {
781+ /// Returns a `Future` that gets fulfilled when cancellation is requested .
782+ pub fn cancelled ( & self ) -> WaitForCancellationFuture < ' _ > {
783783 WaitForCancellationFuture {
784784 cancellation_token : Some ( self ) ,
785785 wait_node : ListNode :: new ( WaitQueueEntry :: new ( ) ) ,
@@ -892,7 +892,7 @@ mod tests {
892892 let token = CancellationToken :: new ( ) ;
893893 assert_eq ! ( false , token. is_cancelled( ) ) ;
894894
895- let wait_fut = token. wait_for_cancellation ( ) ;
895+ let wait_fut = token. cancelled ( ) ;
896896 pin ! ( wait_fut) ;
897897
898898 assert_eq ! (
@@ -901,7 +901,7 @@ mod tests {
901901 ) ;
902902 assert_eq ! ( wake_counter, 0 ) ;
903903
904- let wait_fut_2 = token. wait_for_cancellation ( ) ;
904+ let wait_fut_2 = token. cancelled ( ) ;
905905 pin ! ( wait_fut_2) ;
906906
907907 token. cancel ( ) ;
@@ -933,9 +933,9 @@ mod tests {
933933 child_token. state( ) . snapshot( )
934934 ) ;
935935
936- let child_fut = child_token. wait_for_cancellation ( ) ;
936+ let child_fut = child_token. cancelled ( ) ;
937937 pin ! ( child_fut) ;
938- let parent_fut = token. wait_for_cancellation ( ) ;
938+ let parent_fut = token. cancelled ( ) ;
939939 pin ! ( parent_fut) ;
940940
941941 assert_eq ! (
@@ -978,9 +978,9 @@ mod tests {
978978
979979 let child_token_1 = token. child_token ( ) ;
980980
981- let child_fut = child_token_1. wait_for_cancellation ( ) ;
981+ let child_fut = child_token_1. cancelled ( ) ;
982982 pin ! ( child_fut) ;
983- let parent_fut = token. wait_for_cancellation ( ) ;
983+ let parent_fut = token. cancelled ( ) ;
984984 pin ! ( parent_fut) ;
985985
986986 assert_eq ! (
@@ -1016,7 +1016,7 @@ mod tests {
10161016 ) ;
10171017
10181018 let child_token_2 = token. child_token ( ) ;
1019- let child_fut_2 = child_token_2. wait_for_cancellation ( ) ;
1019+ let child_fut_2 = child_token_2. cancelled ( ) ;
10201020 pin ! ( child_fut_2) ;
10211021
10221022 assert_eq ! (
@@ -1061,9 +1061,9 @@ mod tests {
10611061 ) ;
10621062
10631063 {
1064- let child_fut = child_token. wait_for_cancellation ( ) ;
1064+ let child_fut = child_token. cancelled ( ) ;
10651065 pin ! ( child_fut) ;
1066- let parent_fut = token. wait_for_cancellation ( ) ;
1066+ let parent_fut = token. cancelled ( ) ;
10671067 pin ! ( parent_fut) ;
10681068
10691069 assert_eq ! (
@@ -1177,7 +1177,7 @@ mod tests {
11771177 #[ test]
11781178 fn cancellation_future_is_send ( ) {
11791179 let token = CancellationToken :: new ( ) ;
1180- let fut = token. wait_for_cancellation ( ) ;
1180+ let fut = token. cancelled ( ) ;
11811181
11821182 fn with_send < T : Send > ( _: T ) { }
11831183
0 commit comments