pub fn build(
        self,
        signal_queues: Vec<Queues<(), Signal>>,
        session_queues: Vec<Queues<(), Session>>,
    ) -> Workers<Storage, Parser, Request, Response> {
        let mut signal_queues = signal_queues;
        let mut session_queues = session_queues;
        match self {
            Self::Multi {
                storage,
                mut workers,
            } => {
                let storage_wakers = vec![storage.waker()];
                let worker_wakers: Vec<Arc<Waker>> = workers.iter().map(|v| v.waker()).collect();
                let (mut response_queues, mut request_queues) =
                    Queues::new(worker_wakers, storage_wakers, QUEUE_CAPACITY);

                // The storage thread precedes the worker threads in the set of
                // wakers, so its signal queue is the first element of
                // `signal_queues`. Its request queue is also the first (and
                // only) element of `request_queues`. We remove these and build
                // the storage so we can loop through the remaining signal
                // queues when launching the worker threads.
                let s = storage.build(signal_queues.remove(0), request_queues.remove(0));

                let mut w = Vec::new();
                for worker_builder in workers.drain(..) {
                    w.push(worker_builder.build(
                        signal_queues.remove(0),
                        session_queues.remove(0),
                        response_queues.remove(0),
                    ));
                }

                Workers::Multi {
                    storage: s,
                    workers: w,
                }
            }
            Self::Single { worker } => Workers::Single {
                worker: worker.build(signal_queues.remove(0), session_queues.remove(0)),
            },
        }
    }
/// Converts the builder into the finalized `Workers` type by providing the
/// necessary queues.
Converts the builder into the finalized `Workers` type by providing the
necessary queues.
Converts the builder into the finalized ` Workers ` type by providing the necessary queues .
pub fn build(
        self,
        signal_queues: Vec<Queues<(), Signal>>,
        session_queues: Vec<Queues<(), Session>>,
    ) -> Workers<Storage, Parser, Request, Response> {
        let mut signal_queues = signal_queues;
        let mut session_queues = session_queues;
        match self {
            Self::Multi {
                storage,
                mut workers,
            } => {
                let storage_wakers = vec![storage.waker()];
                let worker_wakers: Vec<Arc<Waker>> = workers.iter().map(|v| v.waker()).collect();
                let (mut response_queues, mut request_queues) =
                    Queues::new(worker_wakers, storage_wakers, QUEUE_CAPACITY);
                // The storage thread precedes the worker threads in the set of
                // wakers, so its signal queue is the first element of
                // `signal_queues`. Its request queue is also the first (and
                // only) element of `request_queues`. We remove these and build
                // the storage so we can loop through the remaining signal
                // queues when launching the worker threads.
                let s = storage.build(signal_queues.remove(0), request_queues.remove(0));
                let mut w = Vec::new();
                for worker_builder in workers.drain(..) {
                    w.push(worker_builder.build(
                        signal_queues.remove(0),
                        session_queues.remove(0),
                        response_queues.remove(0),
                    ));
                }
                Workers::Multi {
                    storage: s,
                    workers: w,
                }
            }
            Self::Single { worker } => Workers::Single {
                worker: worker.build(signal_queues.remove(0), session_queues.remove(0)),
            },
        }
    }
pub fn build ( self , signal_queues : Vec < Queues < ( ) , Signal > > , session_queues : Vec < Queues < ( ) , Session > > , ) -> Workers < Storage , Parser , Request , Response > { let mut signal_queues = signal_queues ; let mut session_queues = session_queues ; match self { Self :: Multi { storage , mut workers , } => { let storage_wakers = vec ! [ storage waker ( ) ] ; let worker_wakers : Vec < Arc < Waker > > = workers . iter ( ) . map ( | v | v . waker ( ) ) . collect ( ) ; let ( mut response_queues , mut request_queues ) = Queues :: new ( worker_wakers , storage_wakers , QUEUE_CAPACITY ) ; // The storage thread precedes the worker threads in the set of // wakers, so its signal queue is the first element of // `signal_queues`. Its request queue is also the first (and // only) element of `request_queues`. We remove these and build // the storage so we can loop through the remaining signal // queues when launching the worker threads. let s = storage . build ( signal_queues . remove ( 0 ) , request_queues . remove ( 0 ) ) ; let mut w = Vec :: new ( ) ; for worker_builder in workers . drain ( .. ) { w . push ( worker_builder . build ( signal_queues . remove ( 0 ) , session_queues . remove ( 0 ) , response_queues . remove ( 0 ) , ) ) ; } Workers :: Multi { storage : s , workers : w , } } Self :: Single { worker } => Workers :: Single { worker : worker . build ( signal_queues . remove ( 0 ) , session_queues . remove ( 0 ) ) , } , } }
Converts the builder into the finalized `Workers` type by providing the
necessary queues.
Converts the builder into the finalized ` Workers ` type by providing the necessary queues .
self
signal_queues
Vec<Queues<(), Signal>>
session_queues
Vec<Queues<(), Session>>
self
signal_queues
Vec<Queues<(), Signal>>
session_queues
Vec<Queues<(), Session>>