pub struct BackgroundTasks { /* private fields */ }Implementations§
Source§impl BackgroundTasks
impl BackgroundTasks
Sourcepub fn add<F>(&self, f: F)
pub fn add<F>(&self, f: F)
Add a synchronous task to run after the response is written.
This matches FastAPI’s BackgroundTasks.add_task(...) UX: you enqueue work
and the server runs it after the response is sent.
Sourcepub fn add_async<Fut>(&self, fut: Fut)
pub fn add_async<Fut>(&self, fut: Fut)
Add an async task (future) to run after the response is written.
Sourcepub async fn execute_all(self)
pub async fn execute_all(self)
Execute all background tasks sequentially.
Trait Implementations§
Source§impl Debug for BackgroundTasks
impl Debug for BackgroundTasks
Auto Trait Implementations§
impl !Freeze for BackgroundTasks
impl RefUnwindSafe for BackgroundTasks
impl Send for BackgroundTasks
impl Sync for BackgroundTasks
impl Unpin for BackgroundTasks
impl UnwindSafe for BackgroundTasks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).