backtalk 0.1.0

An asynchronous, streaming web server for JSON APIs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use {Channel, Reply, Method};
pub fn send_from_reply<C: Channel>(reply: Reply, chan: &C) -> Reply {
    match reply.method() {
        Method::Delete | Method::Post | Method::Patch | Method::Action(_) => {
            match reply.data() {
                Some(data) => chan.send(&reply.method().as_string(), data),
                None => (),
            }
        },
        _ => (),
    }

    reply
}