Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion gio/src/cancellable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::num::NonZeroU64;
use std::{future::IntoFuture, num::NonZeroU64};

use futures_channel::oneshot;
use futures_core::Future;
Expand Down Expand Up @@ -146,6 +146,26 @@ pub trait CancellableExtManual: IsA<Cancellable> {

impl<O: IsA<Cancellable>> CancellableExtManual for O {}

impl IntoFuture for Cancellable {
type Output = ();

type IntoFuture = std::pin::Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>;

fn into_future(self) -> Self::IntoFuture {
self.future()
}
}

impl IntoFuture for &Cancellable {
type Output = ();

type IntoFuture = std::pin::Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>;

fn into_future(self) -> Self::IntoFuture {
self.future()
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading