(
action: &Action,
api_evt: EventFd,
api_sender: Sender<ApiRequest>,
data: Action::RequestBody,
)
| 621 | } |
| 622 | |
| 623 | fn get_response_body<Action: ApiAction<ResponseBody = Option<Body>>>( |
| 624 | action: &Action, |
| 625 | api_evt: EventFd, |
| 626 | api_sender: Sender<ApiRequest>, |
| 627 | data: Action::RequestBody, |
| 628 | ) -> ApiResult<Option<Body>> { |
| 629 | let body = match get_response(action, api_evt, api_sender, data)? { |
| 630 | ApiResponsePayload::VmAction(response) => response.map(Body::new), |
| 631 | ApiResponsePayload::Empty => None, |
| 632 | _ => return Err(ApiError::ResponsePayloadType), |
| 633 | }; |
| 634 | |
| 635 | Ok(body) |
| 636 | } |
| 637 | |
| 638 | pub trait ApiAction: Send + Sync { |
| 639 | type RequestBody: Send + Sync + Sized; |
no test coverage detected