@@ -36,23 +36,12 @@ pub use fork_clone_builder::*;
36
36
pub mod unzip;
37
37
pub use unzip:: * ;
38
38
39
- /// After submitting a service request, use [`Chain`] to describe how
40
- /// the response should be handled. At a minimum, for the response to be
41
- /// delivered, you must choose one of:
42
- /// - `.detach()`: Let the service run to completion and then discard the
43
- /// response data.
44
- /// - `.take()`: As long as the [`Promise`] or one of its clones is alive,
45
- /// the service will continue running to completion and you will be able to
46
- /// view the response (or take the response, but only once). If all clones of
47
- /// the [`Promise`] are dropped before the service is delivered, it will
48
- /// be cancelled.
49
- /// - `.detach_and_take()`: As long as the [`Promise`] or one of its clones is
50
- /// alive, you will be able to view the response (or take the response, but
51
- /// only once). The service will run to completion even if every clone of the
52
- /// [`Promise`] is dropped.
39
+ /// Chain operations onto the output of a workflow node.
53
40
///
54
- /// If you do not select one of the above then the service request will be
55
- /// cancelled without ever attempting to run.
41
+ /// Make sure to use [`Self::connect`] when you're done chaining so that the
42
+ /// final output of the chain gets connected into another node. If the final
43
+ /// output of the chain is meant to be the final output of your workflow then
44
+ /// you should connect it to [`Scope::terminate`].
56
45
#[ must_use]
57
46
pub struct Chain < ' w , ' s , ' a , ' b , T > {
58
47
target : Entity ,
@@ -65,10 +54,8 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
65
54
/// use this to resume building this chain later.
66
55
///
67
56
/// Note that if you do not connect some path of your workflow into the
68
- /// `terminate` slot of your [`Scope`][1] then the workflow will not be able
57
+ /// `terminate` slot of your [`Scope`] then the workflow will not be able
69
58
/// to run.
70
- ///
71
- /// [1]: crate::Scope
72
59
#[ must_use]
73
60
pub fn output ( self ) -> Output < T > {
74
61
Output :: new ( self . scope ( ) , self . target )
@@ -410,7 +397,7 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
410
397
///
411
398
/// As the name suggests, a no-op will not actually do anything, but it adds
412
399
/// a new link (entity) into the chain.
413
- /// [1]: https://en.wikipedia.org/wiki/NOP_(code)
400
+ /// [1]: `< https://en.wikipedia.org/wiki/NOP_(code)>`
414
401
#[ must_use]
415
402
pub fn noop ( self ) -> Chain < ' w , ' s , ' a , ' b , T > {
416
403
let source = self . target ;
@@ -746,7 +733,7 @@ mod tests {
746
733
) ;
747
734
748
735
context. run_with_conditions ( & mut promise, Duration :: from_secs ( 2 ) ) ;
749
- assert ! ( promise. peek ( ) . available( ) . is_some_and( |value| * value == 6.0 ) ) ;
736
+ assert ! ( promise. take ( ) . available( ) . is_some_and( |value| value == 6.0 ) ) ;
750
737
assert ! ( context. no_unhandled_errors( ) ) ;
751
738
}
752
739
@@ -806,7 +793,7 @@ mod tests {
806
793
. with_update_count ( 100 ) ,
807
794
) ;
808
795
809
- assert_eq ! ( promise. peek ( ) . available( ) . copied ( ) , Some ( 16.0 ) ) ;
796
+ assert_eq ! ( promise. take ( ) . available( ) , Some ( 16.0 ) ) ;
810
797
assert ! ( context. no_unhandled_errors( ) ) ;
811
798
}
812
799
@@ -850,7 +837,7 @@ mod tests {
850
837
} ) ;
851
838
852
839
context. run_while_pending ( & mut promise) ;
853
- assert_eq ! ( promise. peek ( ) . available( ) . copied ( ) , Some ( 15.0 ) ) ;
840
+ assert_eq ! ( promise. take ( ) . available( ) , Some ( 15.0 ) ) ;
854
841
assert ! ( context. no_unhandled_errors( ) ) ;
855
842
}
856
843
@@ -943,7 +930,7 @@ mod tests {
943
930
} ) ;
944
931
945
932
context. run_with_conditions ( & mut promise, Duration :: from_secs ( 2 ) ) ;
946
- assert ! ( promise. peek ( ) . available( ) . is_some_and( |v| * v == 1.0 ) ) ;
933
+ assert ! ( promise. take ( ) . available( ) . is_some_and( |v| v == 1.0 ) ) ;
947
934
assert ! ( context. no_unhandled_errors( ) ) ;
948
935
949
936
let mut promise = context. command ( |commands| {
@@ -953,7 +940,7 @@ mod tests {
953
940
} ) ;
954
941
955
942
context. run_with_conditions ( & mut promise, Duration :: from_secs ( 2 ) ) ;
956
- assert ! ( promise. peek ( ) . available( ) . is_some_and( |v| * v == 5.0 ) ) ;
943
+ assert ! ( promise. take ( ) . available( ) . is_some_and( |v| v == 5.0 ) ) ;
957
944
assert ! ( context. no_unhandled_errors( ) ) ;
958
945
959
946
let mut promise = context. command ( |commands| {
0 commit comments