pub trait RequestTrait {
// Required methods
fn headers(&self) -> HashMap<String, String>;
fn insert_headers(&mut self, headers: HashMap<String, String>);
// Provided methods
fn request_type(&self) -> &'static str { ... }
fn body(&self) -> Vec<u8> ⓘ
where Self: Serialize { ... }
fn request_id(&self) -> String { ... }
fn to_payload(&self, client_ip: &str) -> Payload
where Self: Serialize { ... }
fn from_payload<T>(value: &Payload) -> T
where T: for<'a> Deserialize<'a> + Default { ... }
}Expand description
Base trait for all request types
Required Methods§
Sourcefn insert_headers(&mut self, headers: HashMap<String, String>)
fn insert_headers(&mut self, headers: HashMap<String, String>)
Insert headers into the request
Provided Methods§
Sourcefn request_type(&self) -> &'static str
fn request_type(&self) -> &'static str
Get request type identifier
Sourcefn request_id(&self) -> String
fn request_id(&self) -> String
Get unique request identifier
Sourcefn to_payload(&self, client_ip: &str) -> Payloadwhere
Self: Serialize,
fn to_payload(&self, client_ip: &str) -> Payloadwhere
Self: Serialize,
Convert to gRPC Payload
Sourcefn from_payload<T>(value: &Payload) -> Twhere
T: for<'a> Deserialize<'a> + Default,
fn from_payload<T>(value: &Payload) -> Twhere
T: for<'a> Deserialize<'a> + Default,
Deserialize request from gRPC payload
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.