blob: 11fdde439e12a9e3db03523eec057d0d21ce46c1 [file] [log] [blame]
Alice Wang76a36a22023-07-27 12:11:01 +00001// Copyright 2023, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! This module contains the main API for the request processing module.
16
17use alloc::vec::Vec;
18use service_vm_comm::{Request, Response};
19
20/// Processes a request and returns the corresponding response.
21/// This function serves as the entry point for the request processing
22/// module.
23pub fn process_request(request: Request) -> Response {
24 match request {
25 Request::Reverse(v) => Response::Reverse(reverse(v)),
26 }
27}
28
29fn reverse(payload: Vec<u8>) -> Vec<u8> {
30 payload.into_iter().rev().collect()
31}