Skip to content

Commit 128b509

Browse files
committed
Tweaks
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
1 parent 0c96a6f commit 128b509

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/chain.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
204204

205205
/// Build a workflow scope to be used as an element in this chain.
206206
///
207-
/// If you want to connect to the stream outputs, use
208-
/// [`Self::then_scope_node`] instead.
207+
/// If you want to connect to the stream outputs or be able to loop back
208+
/// to the input of this scope, use [`Self::then_scope_node`] instead.
209209
#[must_use]
210210
pub fn then_scope<Response, Streams, Settings>(
211211
self,
@@ -223,14 +223,13 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
223223
}
224224

225225
/// Simplified version of [`Self::then_scope`] limited to a simple input and
226-
/// output. This does not support streams and only uses default scope
227-
/// settings.
226+
/// output.
228227
///
229228
/// Unlike `then_scope`, this function can infer the types for the generics
230229
/// so you don't need to explicitly specify them.
231230
pub fn then_io_scope<Response, Settings>(
232231
self,
233-
build: impl FnOnce(Scope<T, Response, ()>, &mut Builder) -> Settings,
232+
build: impl FnOnce(Scope<T, Response>, &mut Builder) -> Settings,
234233
) -> Chain<'w, 's, 'a, 'b, Response>
235234
where
236235
Response: 'static + Send + Sync,
@@ -258,14 +257,13 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
258257
}
259258

260259
/// Simplified version of [`Self::then_scope_node`] limited to a simple
261-
/// input and output. This does not support streams and only uses default
262-
/// scope settings.
260+
/// input and output.
263261
///
264262
/// Unlike `then_scope_node`, this function can infer the types for the
265263
/// generics so you don't need to explicitly specify them.
266264
pub fn then_io_scope_node<Response, Settings>(
267265
self,
268-
build: impl FnOnce(Scope<T, Response, ()>, &mut Builder) -> Settings,
266+
build: impl FnOnce(Scope<T, Response>, &mut Builder) -> Settings,
269267
) -> Node<T, Response, ()>
270268
where
271269
Response: 'static + Send + Sync,
@@ -275,12 +273,13 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
275273
}
276274

277275
/// Apply a [`Provider`] that filters the response by returning an [`Option`].
278-
/// If the filter returns [`None`] then a cancellation is triggered.
279-
/// Otherwise the chain continues with the value given inside [`Some`].
276+
/// If the filter returns [`None`] then a [`Cancellation`](crate::Cancellation)
277+
/// is triggered. Otherwise the chain continues with the value that was
278+
/// inside [`Some`].
280279
///
281280
/// This is conceptually similar to [`Iterator::filter_map`]. You can also
282-
/// use [`Chain::disposal_filter`] to dispose the remainder of the chain
283-
/// instead of cancelling it.
281+
/// use [`Chain::disposal_filter`] to dispose of the value instead of
282+
/// cancelling the entire scope.
284283
#[must_use]
285284
pub fn cancellation_filter<ThenResponse, F>(
286285
self,
@@ -313,14 +312,14 @@ impl<'w, 's, 'a, 'b, T: 'static + Send + Sync> Chain<'w, 's, 'a, 'b, T> {
313312

314313
/// When the response is delivered, we will make a clone of it and
315314
/// simultaneously pass that clone along two different branches chains: one
316-
/// determined by the `build` function passed into this function and the
317-
/// other determined by the [`Chain`] that gets returned by this function.
315+
/// determined by the `build` function passed into this operation and the
316+
/// other determined by the [`Chain`] that gets returned.
318317
///
319318
/// This can only be applied when `Response` can be cloned.
320319
///
321320
/// See also [`Chain::fork_clone`]
322321
#[must_use]
323-
pub fn fork_clone_branch(
322+
pub fn branch_clone(
324323
self,
325324
build: impl FnOnce(Chain<T>),
326325
) -> Chain<'w, 's, 'a, 'b, T>
@@ -601,7 +600,7 @@ where
601600
) -> Chain<'w, 's, 'a, 'b, T> {
602601
Chain::<Option<T>>::new(
603602
self.target, self.builder,
604-
).branch_option_zip(
603+
).fork_option(
605604
|chain| chain.output(),
606605
build_none,
607606
).0.chain(self.builder)
@@ -614,8 +613,7 @@ where
614613
///
615614
/// The outputs of both builder functions will be zipped as the return value
616615
/// of this function.
617-
#[must_use]
618-
pub fn branch_option_zip<U, V>(
616+
pub fn fork_option<U, V>(
619617
self,
620618
build_some: impl FnOnce(Chain<T>) -> U,
621619
build_none: impl FnOnce(Chain<()>) -> V,

src/stream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,15 @@ impl<T1: StreamPack, T2: StreamPack, T3: StreamPack> StreamPack for (T1, T2, T3)
725725

726726
/// Used by [`ServiceDiscovery`](crate::ServiceDiscovery) to filter services
727727
/// based on what streams they provide. If a stream is required, you should wrap
728-
/// it in [`Require`]. If a stream is optional, then wrap it in [`Option`].
728+
/// the stream type in [`Require`]. If a stream is optional, then wrap it in
729+
/// [`Option`].
729730
///
730731
/// The service you receive will appear as though it provides all the stream
731732
/// types wrapped in both your `Require` and `Option` filters, but it might not
732733
/// actually provide any of the streams that were wrapped in `Option`. A service
733734
/// that does not actually provide the optional stream can be treated as if it
734735
/// does provide the stream, except it will never actually send out any of that
735-
/// stream data.
736+
/// optional stream data.
736737
///
737738
/// ```
738739
/// use bevy_impulse::{*, testing::*};

0 commit comments

Comments
 (0)