clickhouse_rs_async/pool/futures/
get_handle.rs

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