Skip to main content

Module prelude

Module prelude 

Source
Expand description

Prelude module for convenient imports.

Import everything you need with:

use rust_api::prelude::*;

§DI Note

Container is intentionally not in the prelude. The primary DI mechanism is direct Arc<Service> passing to RouterPipeline::mount. Import Container explicitly if you need a registry for large apps: use rust_api::di::Container;

Re-exports§

pub use super::guard;
pub use super::require_bearer;
pub use super::router;
pub use super::ApiRoute;
pub use super::App;
pub use super::Controller;
pub use super::Error;
pub use super::Result;
pub use super::Router;
pub use super::RouterExt;
pub use super::RouterPipeline;
pub use super::RouterTransform;
pub use super::RustAPI;
pub use tokio;

Modules§

header
HTTP header types

Macros§

mount_handlers
Generate a Controller implementation for a type from a handler list.

Structs§

Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
CorsLayer
Layer that applies the Cors middleware which adds headers for CORS.
Json
JSON Extractor / Response.
Parts
Component parts of an HTTP Request
Path
Extractor that will get captures from the URL and parse them using serde.
Query
Extractor that deserializes query strings into some type.
State
Extractor for state.
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).
TraceLayer
Layer that adds high level tracing to a Service.

Traits§

Deserialize
A data structure that can be deserialized from any data format supported by Serde.
FromRequestParts
Types that can be created from request parts.
IntoResponse
Trait for generating responses.
Serialize
A data structure that can be serialized into any data format supported by Serde.

Type Aliases§

Response
Type alias for http::Response whose body type defaults to Body, the most common body type used with axum.

Attribute Macros§

delete
Define a DELETE route handler
get
Define a GET route handler
patch
Define a PATCH route handler
post
Define a POST route handler
put
Define a PUT route handler

Derive Macros§

Deserialize
Serialize