surrealdb/api/method/
cancel.rs1use crate::api::Connection;
2use crate::api::Result;
3use crate::api::Surreal;
4use crate::sql::statements::CancelStatement;
5use std::future::Future;
6use std::future::IntoFuture;
7use std::pin::Pin;
8
9#[derive(Debug)]
11#[must_use = "futures do nothing unless you `.await` or poll them"]
12pub struct Cancel<C: Connection> {
13 pub(crate) client: Surreal<C>,
14}
15
16impl<C> IntoFuture for Cancel<C>
17where
18 C: Connection,
19{
20 type Output = Result<Surreal<C>>;
21 type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send + Sync + 'static>>;
22
23 fn into_future(self) -> Self::IntoFuture {
24 Box::pin(async move {
25 self.client.query(CancelStatement::default()).await?;
26 Ok(self.client)
27 })
28 }
29}