castle_types 0.20.2

all Castle types for Castle_Api
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use tokio::sync::{mpsc, oneshot};

use crate::{Value, Field};


pub struct Next {
    pub sender: mpsc::Sender<(oneshot::Sender<Result<Value, anyhow::Error>>, Field)>,
}

impl Next {
    pub async fn resolve(self, field: Field) -> Result<Value, anyhow::Error> {
        let (sender, receiver) = oneshot::channel();
        self.sender.send((sender, field)).await?;
        receiver.await?
    }
}