Skip to main content

Crate sword_macros

Crate sword_macros 

Source

Attribute Macros§

config
Defines a configuration struct for the application. This macro generates the necessary code to deserialize the struct from the configuration toml file.
controller
This macro is an alias for defining HTTP controllers. Defines an HTTP controller with a base path, and should be used in combination with the #[routes] macro for route implementation.
delete
get
injectable
Marks a struct as injectable.
interceptor
Applies the interceptor to the current scope. This macro can be used to apply an Interceptor to different Adapter types, such as REST controllers or Socket.IO adapters.
main
This is just a re-export of tokio::main to simplify the initial setup of
on
Defines Socket.IO handlers for its associated adapter. This macro should be used inside an impl block of a struct annotated with the #[socketio_adapter] macro.
patch
post
put
socketio_adapter
Marks a struct as a Socket.IO adapter. This macro should be used in combination with the #[on] macro for handler implementation.

Derive Macros§

HttpError
Derive macro for HTTP error enums.
Interceptor
Derive macro for creating interceptors.