gotham/pipeline/
set.rs

1//! Defines the types for adding multiple pipelines into a `PipelineSet` and retaining a handle to
2//! each pipeline for constructing a `PipelineHandleChain`.
3
4use borrow_bag::BorrowBag;
5use std::sync::Arc;
6
7/// Represents the set of all `Pipeline` instances that are available for use when building a
8/// `Router`. A `PipelineSet` is "frozen".
9pub type PipelineSet<P> = Arc<BorrowBag<P>>;
10
11/// A set of `Pipeline` instances that is currently being defined, and can have more `Pipeline`
12/// instances added.
13pub type EditablePipelineSet<P> = BorrowBag<P>;
14
15/// Create an empty set of `Pipeline` instances.
16///
17/// See BorrowBag#add to insert new `Pipeline` instances.
18pub fn new_pipeline_set() -> EditablePipelineSet<()> {
19    BorrowBag::new()
20}
21
22/// Wraps the current set of `Pipeline` instances into a thread-safe reference counting pointer for
23/// use with the `Router`.
24pub fn finalize_pipeline_set<P>(eps: EditablePipelineSet<P>) -> PipelineSet<P> {
25    Arc::new(eps)
26}