Struct imageflow_core::MethodRouter
[−]
[src]
pub struct MethodRouter<'a, T> { /* fields omitted */ }
Methods
impl<'a, T> MethodRouter<'a, T>
[src]
fn new() -> MethodRouter<'a, T>
fn add(&mut self,
method: &'static str,
handler: Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>)
-> Option<Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>>
method: &'static str,
handler: Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>)
-> Option<Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>>
Returns the replaced MethodHandler if one already existed for that method.
fn add_responder<D>(&mut self,
method: &'static str,
responder: Box<Fn(&mut T, D) -> Result<ResponsePayload> + Sync + 'a>)
-> Option<Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>> where D: Deserialize, D: 'a, T: 'a
method: &'static str,
responder: Box<Fn(&mut T, D) -> Result<ResponsePayload> + Sync + 'a>)
-> Option<Box<Fn(&mut T, &[u8]) -> Result<JsonResponse> + Sync + 'a>> where D: Deserialize, D: 'a, T: 'a
fn list(&self) -> &[&str]
fn invoke(&self,
upon: &mut T,
method: &str,
json_request_body: &[u8])
-> Result<JsonResponse>
upon: &mut T,
method: &str,
json_request_body: &[u8])
-> Result<JsonResponse>
Responds with an JsonResponse even for client errors