Crates.io | rocket_extra_codegen |
lib.rs | rocket_extra_codegen |
version | 0.1.0 |
source | src |
created_at | 2019-02-04 20:18:53.92168 |
updated_at | 2019-02-07 16:23:28.271989 |
description | Additional macros for rocket.rs |
homepage | |
repository | https://github.com/Woyten/rocket_extra_codegen |
max_upload_size | |
id | 112749 |
size | 7,260 |
FromRequest
use rocket_extra_codegen::FromRequest;
#[derive(FromRequest)]
struct BookingService {
db_conn: DbConnection,
queue_conn: QueueConnection,
user: AuthUser,
}
The errors of the individual fields will be converted via the From
trait to a common target error type. The target error type defaults to ()
but can be overridden manually:
use rocket_extra_codegen::FromRequest;
#[derive(FromRequest)]
#[error_type = "MyError"]
struct BookingService {
db_conn: DbConnection,
queue_conn: QueueConnection,
user: AuthUser,
}