pub(crate) async fn make_request<T, Q, F>(self, f: F, queue_kind: QueueKind) -> T
    where
        T: Send + 'static,
        Q: Into<REv>,
        F: FnOnce(Responder<T>) -> Q,
    {
        // Prepare a channel.
        let (sender, receiver) = oneshot::channel();

        // Create response function.
        let responder = Responder::new(sender, self.event_queue.shutdown_flag());

        // Now inject the request event into the event loop.
        let request_event = f(responder).into();
        self.event_queue.schedule(request_event, queue_kind).await;

        match receiver.await {
            Ok(value) => value,
            Err(err) => {
                // The channel should never be closed, ever. If it is, we pretend nothing happened
                // though, instead of crashing.
                if self.event_queue.shutdown_flag().is_set() {
                    debug!(%err, ?queue_kind, channel=?type_name::<T>(), "ignoring closed channel due to shutdown")
                } else {
                    error!(%err, ?queue_kind, channel=?type_name::<T>(), "request for channel closed, this may be a bug? \
                           check if a component is stuck from now on");
                }

                // We cannot produce any value to satisfy the request, so we just abandon this task
                // by waiting on a resource we can never acquire.
                let _ = UNOBTAINABLE.acquire().await;
                panic!("should never obtain unobtainable semaphore");
            }
        }
    }
/// Performs a request.
///
/// Given a request `Q`, that when completed will yield a result of `T`, produces a future
/// that will
///
/// 1. create an event to send the request to the respective component (thus `Q: Into<REv>`),
/// 2. waits for a response and returns it.
///
/// This function is usually only used internally by effects implement on the effects builder,
/// but IO components may also make use of it.
Performs a request.
Given a request `Q`, that when completed will yield a result of `T`, produces a future
that will

1. create an event to send the request to the respective component (thus `Q: Into`),
2. waits for a response and returns it.

This function is usually only used internally by effects implement on the effects builder,
but IO components may also make use of it.
Performs a request . Given a request ` Q ` that when completed will yield a result of ` T ` produces a future that will 1 . create an event to send the request to the respective component ( thus ` Q : Into ` ) 2 . waits for a response and returns it . This function is usually only used internally by effects implement on the effects builder but IO components may also make use of it .
pub(crate) async fn make_request<T, Q, F>(self, f: F, queue_kind: QueueKind) -> T
    where
        T: Send + 'static,
        Q: Into<REv>,
        F: FnOnce(Responder<T>) -> Q,
    {
        // Prepare a channel.
        let (sender, receiver) = oneshot::channel();
        // Create response function.
        let responder = Responder::new(sender, self.event_queue.shutdown_flag());
        // Now inject the request event into the event loop.
        let request_event = f(responder).into();
        self.event_queue.schedule(request_event, queue_kind).await;
        match receiver.await {
            Ok(value) => value,
            Err(err) => {
                // The channel should never be closed, ever. If it is, we pretend nothing happened
                // though, instead of crashing.
                if self.event_queue.shutdown_flag().is_set() {
                    debug!(%err, ?queue_kind, channel=?type_name::<T>(), "ignoring closed channel due to shutdown")
                } else {
                    error!(%err, ?queue_kind, channel=?type_name::<T>(), "request for channel closed, this may be a bug? \
                           check if a component is stuck from now on");
                }
                // We cannot produce any value to satisfy the request, so we just abandon this task
                // by waiting on a resource we can never acquire.
                let _ = UNOBTAINABLE.acquire().await;
                panic!("should never obtain unobtainable semaphore");
            }
        }
    }
pub ( crate ) async fn make_request < T , Q , F > ( self , f : F , queue_kind : QueueKind ) -> T where T : Send + ' static , Q : Into < REv > , F : FnOnce ( Responder < T > ) -> Q , { // Prepare a channel. let ( sender , receiver ) = oneshot :: channel ( ) ; // Create response function. let responder = Responder :: new ( sender , self . event_queue . shutdown_flag ( ) ) ; // Now inject the request event into the event loop. let request_event = f ( responder ) . into ( ) ; self . event_queue . schedule ( request_event , queue_kind ) . await ; match receiver . await { Ok ( value ) => value , Err ( err ) => { // The channel should never be closed, ever. If it is, we pretend nothing happened // though, instead of crashing. if self . event_queue . shutdown_flag ( ) . is_set ( ) { debug ! ( err queue_kind channel type_name T ( ) " " ) } else { error ! ( err queue_kind channel type_name T ( ) " \
 " ) ; } // We cannot produce any value to satisfy the request, so we just abandon this task // by waiting on a resource we can never acquire. let _ = UNOBTAINABLE . acquire ( ) . await ; panic ! ( " " ) ; } } }
Performs a request.
Performs a request .
self
f
F
queue_kind
QueueKind
self
f
F
queue_kind
QueueKind