1 unstable release
0.1.0 | Feb 7, 2019 |
---|---|
0.0.0 |
|
#198 in #rocket
7KB
104 lines
Additional macros for rocket.rs
Derive 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,
}
Dependencies
~2MB
~48K SLoC