mirror of https://github.com/fafhrd91/actix-net
add track_caller attribute to spawn calls
This commit is contained in:
parent
dc67ba770d
commit
31ae8cd291
|
@ -1,6 +1,9 @@
|
|||
# Changes
|
||||
|
||||
## Unreleased - 2022-xx-xx
|
||||
- Add `#[track_caller]` attribute to `spawn` functions and methods. [#454]
|
||||
|
||||
[#454]: https://github.com/actix/actix-net/pull/454
|
||||
|
||||
|
||||
## 2.7.0 - 2022-03-08
|
||||
|
|
|
@ -260,6 +260,7 @@ impl Arbiter {
|
|||
/// If you require a result, include a response channel in the future.
|
||||
///
|
||||
/// Returns true if future was sent successfully and false if the Arbiter has died.
|
||||
#[track_caller]
|
||||
pub fn spawn<Fut>(&self, future: Fut) -> bool
|
||||
where
|
||||
Fut: Future<Output = ()> + Send + 'static,
|
||||
|
@ -275,6 +276,7 @@ impl Arbiter {
|
|||
/// channel in the function.
|
||||
///
|
||||
/// Returns true if function was sent successfully and false if the Arbiter has died.
|
||||
#[track_caller]
|
||||
pub fn spawn_fn<F>(&self, f: F) -> bool
|
||||
where
|
||||
F: FnOnce() + Send + 'static,
|
||||
|
|
|
@ -195,6 +195,7 @@ pub mod task {
|
|||
/// assert!(handle.await.unwrap_err().is_cancelled());
|
||||
/// # });
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[inline]
|
||||
pub fn spawn<Fut>(f: Fut) -> JoinHandle<Fut::Output>
|
||||
where
|
||||
|
|
|
@ -53,6 +53,7 @@ impl Runtime {
|
|||
/// # Panics
|
||||
/// This function panics if the spawn fails. Failure occurs if the executor is currently at
|
||||
/// capacity and is unable to spawn a new future.
|
||||
#[track_caller]
|
||||
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
|
||||
where
|
||||
F: Future + 'static,
|
||||
|
@ -73,6 +74,7 @@ impl Runtime {
|
|||
///
|
||||
/// The caller is responsible for ensuring that other spawned futures complete execution by
|
||||
/// calling `block_on` or `run`.
|
||||
#[track_caller]
|
||||
pub fn block_on<F>(&self, f: F) -> F::Output
|
||||
where
|
||||
F: Future,
|
||||
|
|
|
@ -204,6 +204,7 @@ impl SystemRunner {
|
|||
}
|
||||
|
||||
/// Runs the provided future, blocking the current thread until the future completes.
|
||||
#[track_caller]
|
||||
#[inline]
|
||||
pub fn block_on<F: Future>(&self, fut: F) -> F::Output {
|
||||
self.rt.block_on(fut)
|
||||
|
|
Loading…
Reference in New Issue