Skip to main content

create_with_stop

Function create_with_stop 

Source
pub async fn create_with_stop<F, Fut, S, SFut>(
    func: F,
    stop_callback: S,
) -> Result<()>
where F: FnOnce() -> Fut, Fut: Future<Output = Result<()>>, S: FnOnce() -> SFut, SFut: Future<Output = Result<()>>,
Expand description

ยงcreate_with_stop

#[tokio::main]
async fn main() {
    sssd::create_with_stop(your_async_func, stop_callback).await.unwrap()
}

async fn your_async_func() -> anyhow::Result<()> {
    // ...
}

async fn stop_callback() -> anyhow::Result<()> {
    // ...
}