Expand description
High-level Rust API for Spikard.
This crate provides the ergonomic App interface that mirrors the
batteries-included experience available in the Python/Node/Ruby bindings.
Routes, DTO schemas, and advanced transports (WebSocket/SSE) are all backed
by the shared spikard-http runtime, ensuring identical validation and
middleware behaviour across languages.
Re-exports§
pub use upload::UploadFile;
Modules§
- testing
- Testing utilities for Spikard applications.
- upload
- File upload handling for multipart/form-data requests.
- validation
- JSON-RPC and request validation utilities.
Structs§
- ApiKey
Config - API Key authentication configuration
- App
- Spikard application builder.
- Background
JobError - Background
JobMetadata - Background
Task Config - Configuration for in-process background task execution.
- Compression
Config - Compression configuration shared across runtimes
- Cors
Config - CORS configuration for a route
- Full
Schema Config - Configuration for fully-featured schemas with Query, Mutation, and Subscription types
- GraphQL
Route Config - Configuration for GraphQL routes
- GraphQL
Subscription Snapshot - Snapshot of a GraphQL subscription exchange over WebSocket.
- Grpc
Config - Configuration for gRPC support
- Json
RpcConfig - JSON-RPC server configuration
- Json
RpcMethod Info - JSON-RPC method metadata for routes that support JSON-RPC
- JwtConfig
- JWT authentication configuration
- Open
ApiConfig - OpenAPI configuration
- Problem
Details - RFC 9457 Problem Details for HTTP APIs
- Query
Mutation Config - Configuration for schemas with Query and Mutation types
- Query
Only Config - Configuration for schemas with only Query type
- Rate
Limit Config - Rate limiting configuration shared across runtimes
- Request
Context - Wrapper around the raw request and validated metadata.
- Response
- HTTP Response with custom status code, headers, and content
- Response
Snapshot - Snapshot of an Axum response used by higher-level language bindings.
- Route
- Route definition with compiled validators
- Route
Builder - Builder for defining a route.
- Route
Metadata - Route metadata extracted from bindings
- Schema
Config - Configuration for GraphQL schema building.
- Server
Config - Server configuration
- SseEvent
- An individual SSE event
- Static
Files Config - Static file serving configuration
- Test
Client - Core test client for making HTTP requests to a Spikard application.
- WebSocket
Connection - WebSocket connection wrapper for testing.
Enums§
- AppError
- Error type for application builder operations.
- Handler
Response - Unified response type that can represent either a ready response or a streaming body.
- Hook
Result - Result of a lifecycle hook execution
- Method
- HTTP method
- Snapshot
Error - Possible errors while converting an Axum response into a snapshot.
- WebSocket
Message - A WebSocket message that can be text or binary.
Traits§
- Into
Handler - Convert user-facing handler functions into the low-level
Handlertrait. - Lifecycle
Hook - Trait for lifecycle hooks on native targets (Send + Sync, Send futures).
- SseEvent
Producer - SSE event producer trait
- WebSocket
Handler - WebSocket message handler trait
Functions§
- add_
cors_ headers - Add CORS headers to a successful response
- delete
- Convenience helper for building a DELETE route.
- get
- Convenience helper for building a GET route.
- handle_
preflight - Handle CORS preflight (OPTIONS) request
- patch
- Convenience helper for building a PATCH route.
- post
- Convenience helper for building a POST route.
- put
- Convenience helper for building a PUT route.
- request_
hook - Create a request hook for the current target.
- response_
hook - Create a response hook for the current target.
- validate_
cors_ request - Validate a non-preflight CORS request
Type Aliases§
- Handler
Result - Result type for handlers
- Lifecycle
Hooks - Lifecycle
Hooks Builder