Skip to content

Commit

Permalink
Take self by value in JoinHandle::abort
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Jun 20, 2023
1 parent 78a39e7 commit bf8bbed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions internal/core/future.rs
Expand Up @@ -104,7 +104,9 @@ impl<T> Future for JoinHandle<T> {
}
Poll::Pending
}
FutureState::Finished(x) => Poll::Ready(x.take().expect("Polling completed future")),
FutureState::Finished(x) => {
Poll::Ready(x.take().expect("Polling completed or aborted JoinHandle"))
}
}
}
}
Expand All @@ -113,7 +115,7 @@ impl<T> JoinHandle<T> {
/// If the future hasn't completed yet, this will make the event loop stop polling the corresponding future and it will be dropped
///
/// Once this handle has been aborted, it can no longer be polled
pub fn abort(&self) {
pub fn abort(self) {
self.0.aborted.store(true, atomic::Ordering::Relaxed);
}
}
Expand All @@ -132,8 +134,7 @@ unsafe impl<T: Send> Send for JoinHandle<T> {}
///
/// # Example
///
/// ```rust
/// # i_slint_backend_testing::init();
/// ```rust,no_run
/// slint::spawn_local(async move {
/// // code here that can await
/// }).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion internal/interpreter/ffi.rs
Expand Up @@ -153,7 +153,7 @@ pub extern "C" fn slint_interpreter_value_to_bool(val: &ValueOpaque) -> Option<&
}
}

/// Extracts a SharedVector<ValueOpaque> out of the given value `val`, writes that into the
/// Extracts a `SharedVector<ValueOpaque>` out of the given value `val`, writes that into the
/// `out` parameter and returns true; returns false if the value does not hold an extractable
/// array.
#[no_mangle]
Expand Down

0 comments on commit bf8bbed

Please sign in to comment.