pub trait ResponseBuildExt {
// Required methods
fn code(self, code: ResponseCode) -> Self;
fn header<I1: Into<String>, I2: Into<String>>(
self,
name: I1,
value: I2,
) -> Self;
fn payload(self, payload: Vec<String>) -> Self;
}
Expand description
Trait to allow modifying the response by either passing it by value or by mutable reference
use taskserver_protocol::response::*;
let mut response = Response::new();
let mut borrowed = &mut response;
borrowed.code(ResponseCode::NoChange);
//we can still access the value (it was passed by ref)
response.header("test", "foo");
Required Methods§
Sourcefn code(self, code: ResponseCode) -> Self
fn code(self, code: ResponseCode) -> Self
sets the code
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.