[][src]Trait taskserver_protocol::response::ResponseBuildExt

pub trait ResponseBuildExt {
    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; }

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

fn code(self, code: ResponseCode) -> Self

sets the code

fn header<I1: Into<String>, I2: Into<String>>(self, name: I1, value: I2) -> Self

sets the given header to the provided name

fn payload(self, payload: Vec<String>) -> Self

sets the response payload

Loading content...

Implementors

impl<T: BorrowMut<Response>> ResponseBuildExt for T[src]

Loading content...