Skip to main content

run

Function run 

Source
pub async fn run<F, Fut>(init: F) -> Result<(), Error>
where F: FnOnce(ExtensionHandle) -> Fut + Send + 'static, Fut: Future<Output = Result<(), Error>> + Send + 'static,
Expand description

Starts the extension runtime, calling init with an ExtensionHandle.

This is the main entry point for an extension. The runtime runs until the host disconnects or ExtensionHandle::shutdown is called.

use powhttp_sdk::{run, Error, ExtensionHandle};

#[tokio::main]
async fn main() -> Result<(), Error> {
    run(async |handle: ExtensionHandle| {
        Ok(())
    }).await
}