tlsn_prover/
future.rs

1//! This module collects futures which are used by the [Prover].
2
3use super::{state, Prover, ProverControl, ProverError};
4use futures::Future;
5use std::pin::Pin;
6
7/// Prover future which must be polled for the TLS connection to make progress.
8pub struct ProverFuture {
9    #[allow(clippy::type_complexity)]
10    pub(crate) fut:
11        Pin<Box<dyn Future<Output = Result<Prover<state::Closed>, ProverError>> + Send + 'static>>,
12    pub(crate) ctrl: ProverControl,
13}
14
15impl ProverFuture {
16    /// Returns a controller for the prover for advanced functionality.
17    pub fn control(&self) -> ProverControl {
18        self.ctrl.clone()
19    }
20}
21
22impl Future for ProverFuture {
23    type Output = Result<Prover<state::Closed>, ProverError>;
24
25    fn poll(
26        mut self: Pin<&mut Self>,
27        cx: &mut std::task::Context<'_>,
28    ) -> std::task::Poll<Self::Output> {
29        self.fut.as_mut().poll(cx)
30    }
31}