You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rpc_server.rs
    path of file: ./repos/risingwave/src/object_store/src/object/sim
    
    the code of the file until where you have to start completion: // Copyright 2024 RisingWave Labs
//
// Licensed under the Apac
    
    pub async fn serve(self, addr: SocketAddr) -> Result<()> {
        let ep = Endpoint::bind(addr).await?;
        let service = SimService::new();
        let service = Arc::new(service);

        loop {
            let (tx, mut rx, _) = ep.accept1().await?;
            let service = service.clone();
            madsim::task::spawn(async move {
                let request = *rx.recv().await?.downcast::<Request>().unwrap();
                use super::service::Request::*;

                let response: Payload = match request {
                    Upload { path, obj } => Box::new(service.upload(path, obj).await),
                    Read { path } => Box::new(service.read(path).await),
                    Delete { path } => Box::new(service.delete(path).await),
                    DeleteObjects { paths } => Box::new(service.delete_objects(paths).await),
                    List { path } => Box::new(service.list(path).await),
                    Metadata { path } => Box::new(service.metadata(path).await),
                };
                tx.send(response).await?;
                Ok(()) as Result<()>
            });
        }
    }