-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrequest.rs
28 lines (26 loc) · 996 Bytes
/
request.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::*;
use serde::{Deserialize, Serialize};
use tap::Pipe;
/// Requests clinets can make
#[derive(Debug, Serialize, Deserialize, TypeDef)]
#[serde(tag = "method", content = "args", rename_all = "snake_case")]
pub enum Request {
/// Register project root and get broadcaster reader file description
Register(RegisterRequest),
/// Build Project and get path to where to build log will be located
Build(BuildRequest),
/// Run Project and get path to where to Runtime log will be located
Run(RunRequest),
/// Drop projects at a given roots
Drop(DropRequest),
}
impl Request {
pub async fn handle(self) -> Response {
match self {
Request::Register(req) => req.handle().await.pipe(Response::new),
Request::Build(req) => req.handle().await.pipe(Response::new),
Request::Run(req) => req.handle().await.pipe(Response::new),
Request::Drop(req) => req.handle().await.pipe(Response::new),
}
}
}