clickhouse_readonly/pool/futures/
get_handle.rs

1use pin_project::pin_project;
2use std::task::{Context, Poll};
3use std::{future::Future, pin::Pin};
4
5use crate::{client::ClientHandle, error::Result, pool::Pool};
6
7/// Future that resolves to a `ClientHandle`.
8#[pin_project]
9pub struct GetHandle {
10    #[pin]
11    pool: Pool,
12}
13
14impl GetHandle {
15    pub(crate) fn new(pool: &Pool) -> Self {
16        Self { pool: pool.clone() }
17    }
18}
19
20impl Future for GetHandle {
21    type Output = Result<ClientHandle>;
22
23    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
24        self.project().pool.poll(cx)
25    }
26}