Skip to main content

Module prelude

Module prelude 

Source
Expand description

Prelude module: use rustapi_rs::prelude::*.

Macros§

debug
Constructs an event at the debug level.
error
Constructs an event at the error level.
info
Constructs an event at the info level.
route
Helper macro to create a Route from a handler with RouteHandler trait
trace
Constructs an event at the trace level.
warn
Constructs an event at the warn level.

Structs§

ApiError
Standard API error type
AsyncValidatedJson
Async validated JSON body extractor
Body
Raw body bytes extractor
BodyLimitLayer
Body size limit middleware layer
ClientIp
Client IP address extractor
Created
201 Created response wrapper
CursorPaginate
Cursor-based pagination extractor
CursorPaginated
Cursor-based paginated response
EventBus
In-process publish/subscribe event bus
Extension
Extension extractor
HeaderValue
Single header value extractor
Headers
Headers extractor
HealthCheck
Health check configuration
HealthCheckBuilder
Builder for health check configuration
HealthCheckResult
Overall health check result
HealthEndpointConfig
Configuration for built-in health endpoints.
Html
HTML response wrapper
Json
JSON body extractor
KeepAlive
Keep-alive configuration for SSE connections
Multipart
Multipart form data extractor
MultipartConfig
Configuration for multipart form handling
MultipartField
A single field from a multipart form
NoContent
204 No Content response
Paginate
Offset-based pagination extractor
Paginated
Paginated response wrapper with metadata and navigation links.
Path
Path parameter extractor
ProductionDefaultsConfig
Configuration for RustAPI’s built-in production baseline preset.
Query
Query string extractor
Redirect
Redirect response
Request
HTTP Request wrapper
RequestId
A unique identifier for a request
RequestIdLayer
Middleware layer that generates a unique request ID for each request
Route
Represents a route definition that can be registered with .mount()
Router
Main router
RustApi
Main application builder for RustAPI
RustApiConfig
Configuration builder for RustAPI with auto-routes
Sse
Server-Sent Events response wrapper
SseEvent
A Server-Sent Event
State
State extractor
StaticFile
Static file response
StaticFileConfig
Static file serving configuration
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).
StreamBody
A streaming body wrapper for HTTP responses
StreamingMultipart
Streaming multipart extractor for large file uploads.
StreamingMultipartField
A single streaming field from a multipart form.
TracingLayer
Middleware layer that creates tracing spans for requests
Typed
Typed path extractor
UploadedFile
File data wrapper for convenient access to uploaded files
ValidatedJson
Validated JSON body extractor
WithStatus
Generic wrapper for returning a response with a custom status code.

Enums§

HealthStatus
Health status of a component

Traits§

AsyncValidate
Trait for asynchronous validation of a struct.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
IntoResponse
Trait for types that can be converted into an HTTP response
Serialize
A data structure that can be serialized into any data format supported by Serde.
TypedPath
Trait for defining typed paths
V2Validate
Trait for synchronous validation of a struct.
Validatable
Unified validation trait for synchronous validation

Functions§

delete
Create a DELETE route handler
delete_route
Create a DELETE route
get
Create a GET route handler
get_route
Create a GET route
patch
Create a PATCH route handler
patch_route
Create a PATCH route
post
Create a POST route handler
post_route
Create a POST route
put
Create a PUT route handler
put_route
Create a PUT route
serve_dir
Create a static file serving route
sse_from_iter
Helper function to create an SSE response from an iterator of events
sse_response
Create an SSE response from a synchronous iterator of events

Type Aliases§

Response
HTTP Response type
Result
Result type alias for RustAPI operations

Derive Macros§

ApiError
Derive macro for implementing IntoResponse for error enums
Deserialize
Schema
Derive macro for OpenAPI Schema trait
Serialize
TypedPath
Derive macro for TypedPath