Crate blueprint_router

Source
Expand description

Blueprint SDK Job Router

This crate provides the Router, which is used to route jobs to different handlers based on their JobId.

§Usage

use blueprint_sdk::Router;
use blueprint_sdk::job::JobWithoutContextExt;
use blueprint_sdk::{IntoJobResult, JobResult};

// Define a job function. See [`Job`] for more details
async fn my_job() -> String {
    String::from("Hello world!")
}

// Give the job some kind of ID. Many types can be converted
// into a [`JobId`]. See [`JobId`] for more details
const MY_JOB_ID: u32 = 0;

let router = Router::new().route(MY_JOB_ID, my_job);

§See also

§Features

blueprint-router is fully no_std compatible

§Core

  • tracing (enabled by default) — Enable tracing support

Modules§

future
Router future types

Structs§

Router
The router type for composing jobs and services.
RouterAsService
A Router converted into a borrowed Service with a fixed body type.