Skip to main content

Crate flatbed

Crate flatbed 

Source

Re-exports§

pub use readiness::Readiness;
pub use readiness::ReadinessGate;
pub use flatbuffers;
pub use serde;
pub use serde_json;

Modules§

hyper
Hyper integration for flatbed HTTP server
readiness
Runtime readiness gates.

Macros§

register_worker
Register a Worker implementor with the Flatbed worker system.
static_route
Mount a directory of static files, served under a URL prefix.

Structs§

EnumSchema
A generated FlatBuffer enum, registered at compile time alongside TypeSchema. variants are listed in FlatBuffer value order.
FieldInfo
Schema field info for OpenAPI generation
Flatbed
Main entry point for running a Flatbed server with two-phase boot pattern.
FlatbedConfig
Configuration for flatbed routes and optional telemetry integration.
FlatbedRouteError
HTTP-conformant error type with status code, error code, and optional details
FlatbedSchema
The FlatBuffer binary reflection (.bfbs) for a service’s schemas, baked in by generated code so the runtime can serve it at /schema.bfbs. The bytes are the exact flatc -b --schema output — complete for the wire codec (field ids, enum underlying types + values, defaults). One is submitted per compiled root schema.
FlatbedWorkerError
Simple error type for background workers
HeaderMap
A specialized multimap for header names and values.
HeaderName
Represents an HTTP header field name
HeaderValue
Represents an HTTP header field value.
LegacyResponseDeprecated
Legacy response wrapper that contains a FlatBufferBuilder with a finalized response of type T
Method
The Request Method (VERB)
OpenApiRouteInfo
OpenAPI metadata for a route
Request
HTTP request wrapper providing context alongside the deserialized body
RequestParts
Parts extracted from an HTTP request (used internally by macro)
Response
HTTP response wrapper with status code and headers
ResponseParts
Parts for constructing an HTTP response (used internally by macro)
RestartPolicy
Opt-in restart policy for a registered worker.
RouteConflict
Validation error for route conflicts
RouteInfo
Route information collected from #route decorators
SchemaInfo
Schema information
StaticRouteInfo
A static-file mount registered by the static_route! macro.
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).
TypeConflict
A bare name registered under two different namespaces in the type registry.
TypeFieldInfo
A single field of a registered TypeSchema.
TypeSchema
A generated FlatBuffer table, registered at compile time so the full set of types is discoverable at runtime.
WorkerDrainInfo
Drain function metadata submitted by the register_*! macros alongside the worker itself.
WorkerInfo
Worker metadata registered via the register_*! macros

Enums§

Codec
A wire encoding a route speaks.
Error
Error type for flatbed operations
HttpMethod
HTTP method for route registration
StaticSource
Where a static mount reads its files from.
WorkerState
Lifecycle state of a supervised worker.

Traits§

FromFlatBuffer
Trait for JSON companion types that can be decoded from FlatBuffer bytes
HasJsonCompanion
Trait connecting FlatBuffer types to their plain struct companions
HasPlainStruct
Trait connecting plain structs to their FlatBuffer types
ToFlatBuffer
Trait for JSON companion types that can convert to FlatBuffer bytes
Worker
Trait-based background worker.

Functions§

accepted_codec
The codec a request’s accept header asks the response to use, when it names one flatbed serves. Both named, the earlier wins; neither named, or no header, is None and the response follows the request’s content-type. A body is still decoded by content-type alone.
get_enum_schema
Look up a registered EnumSchema by its bare name.
get_root
Safely reads a root table from a buffer
get_routes
Get the route map with all registered routes
get_schema_bfbs
The baked-in FlatBuffer reflection when a schema was compiled into this service. Defined for the single-root case: flatc’s .bfbs covers a root’s full include graph, so one submission describes everything. With multiple root schemas the result is unspecified — inventory collection order gives no defined choice among them.
get_static_routes
Returns the static-file mounts registered via static_route!.
get_type_schema
Look up a registered TypeSchema by its bare type name.
get_worker_drains
Get all registered drain functions.
get_workers
Get all registered workers
new_builder
Creates a new FlatBufferBuilder with the default capacity
new_builder_with_capacity
Creates a new FlatBufferBuilder with a specific capacity
run_basic_worker
Run a Worker by downcasting the context and delegating to Worker::run.
run_basic_worker_drain
Drain a Worker by downcasting the context and delegating to Worker::drain.
validate_routes
Validate that all routes are unique (no duplicate paths)
validate_type_registry
Validate that every registered type and enum has a unique bare name.
verify_buffer
Verifies a flatbuffer message
worker_states
Current state of every worker the supervisor has started, ordered by name.

Type Aliases§

AsyncHandlerFn
Async handler function type for hyper integration
BeforeRequestHook
A guard invoked before a matched #[route] handler runs.
BoxFuture
Boxed, Send future alias for trait return types.
DrainFn
Drain function signature for graceful shutdown of workers.
FlatbedErrorDeprecated
Deprecated alias for FlatbedRouteError
HandlerFn
Handler function type for route registration
RouteMap
Route map type: (path, method) -> RouteInfo with handler
WorkerFn
Worker function signature for background tasks

Attribute Macros§

main
Entry point macro for flatbed applications
route
Route decorator for async handler functions