pub async fn listen(&mut self) -> Result<(), QueueTriggerClosedError> {
        use tokio::sync::mpsc::error::TryRecvError;

        // wait for next item
        if self.0.recv().await.is_some() {
            // drain the channel
            loop {
                match self.0.try_recv() {
                    Err(TryRecvError::Closed) => return Err(QueueTriggerClosedError),
                    Err(TryRecvError::Empty) => return Ok(()),
                    Ok(()) => {}
                }
            }
        } else {
            Err(QueueTriggerClosedError)
        }
    }
/// Listen for one or more items to come through, draining the channel
/// each time. Bubble up errors on empty channel.
Listen for one or more items to come through, draining the channel
each time. Bubble up errors on empty channel.
Listen for one or more items to come through draining the channel each time . Bubble up errors on empty channel .
pub async fn listen(&mut self) -> Result<(), QueueTriggerClosedError> {
        use tokio::sync::mpsc::error::TryRecvError;
        // wait for next item
        if self.0.recv().await.is_some() {
            // drain the channel
            loop {
                match self.0.try_recv() {
                    Err(TryRecvError::Closed) => return Err(QueueTriggerClosedError),
                    Err(TryRecvError::Empty) => return Ok(()),
                    Ok(()) => {}
                }
            }
        } else {
            Err(QueueTriggerClosedError)
        }
    }
pub async fn listen ( & mut self ) -> Result < ( ) , QueueTriggerClosedError > { use tokio :: sync :: mpsc :: error :: TryRecvError ; // wait for next item if self . 0 . recv ( ) . await . is_some ( ) { // drain the channel loop { match self . 0 . try_recv ( ) { Err ( TryRecvError :: Closed ) => return Err ( QueueTriggerClosedError ) , Err ( TryRecvError :: Empty ) => return Ok ( ( ) ) , Ok ( ( ) ) => { } } } } else { Err ( QueueTriggerClosedError ) } }
Listen for one or more items to come through, draining the channel
each time.
Listen for one or more items to come through draining the channel each time .
&mut self
&mut self