Mountain/RPC/CocoonService/GenericRequest/FileSystem/
Rename.rs1use serde_json::Value;
2use tonic::Response;
3use ::Vine::Generated::GenericResponse;
4
5pub async fn Fn(RequestId:u64, Params:Value) -> Response<GenericResponse> {
6 let From = Params.get("from").and_then(|V| V.as_str()).unwrap_or("");
7
8 let To = Params.get("to").and_then(|V| V.as_str()).unwrap_or("");
9
10 match tokio::fs::rename(From, To).await {
11 Ok(()) => super::OkResponse(RequestId, &Value::Null),
12
13 Err(Error) => super::ErrResponse(RequestId, -32000, format!("fs.rename: {}", Error)),
14 }
15}