Skip to main content

Crate spikard

Crate spikard 

Source
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
upload
File upload handling for multipart/form-data requests.
validation
JSON-RPC and request validation utilities.

Structs§

App
Spikard application builder.
CompressionConfig
Compression configuration shared across runtimes
CorsConfig
CORS configuration for a route
RateLimitConfig
Rate limiting configuration shared across runtimes
RequestContext
Wrapper around the raw request and validated metadata.
RouteBuilder
Builder for defining a route.
ServerConfig
Server configuration
SseEvent
An individual SSE event
StaticFilesConfig
Static file serving configuration

Enums§

AppError
Error type for application builder operations.
HandlerResponse
Unified response type that can represent either a ready response or a streaming body.
HookResult
Result of a lifecycle hook execution
Method
HTTP method

Traits§

IntoHandler
Convert user-facing handler functions into the low-level Handler trait.
LifecycleHook
Trait for lifecycle hooks on native targets (Send + Sync, Send futures).
SseEventProducer
SSE event producer trait
WebSocketHandler
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§

HandlerResult
Result type for handlers
LifecycleHooks
LifecycleHooksBuilder