January 2019
Intermediate to advanced
520 pages
14h 32m
English
The request type called QrRequest contains data about the QR image:
#[derive(Clone, Debug, Deserialize, Serialize)]pub struct QrRequest { pub image: Vec<u8>,}
It implements the Message trait from actix, which is to be set as an associated type of QueueHandler:
impl Message for QrRequest { type Result = ();}
The response type is represented by the QrResponse enumeration:
#[derive(Clone, Debug, Deserialize, Serialize)]pub enum QrResponse { Succeed(String), Failed(String),}
It contains two variants: Succeed for successful results and Failed for errors. It is similar to the Result type of the standard library, but we decided to add our own type to have a chance to override the serialization behavior when we need it. But we ...
Read now
Unlock full access