pub fn run_server<Req, Resp, S>(serve: S) -> Result<(), IpcError>where
Req: Serialize + for<'de> Deserialize<'de>,
Resp: Serialize + for<'de> Deserialize<'de>,
S: Serve<Req = Req, Resp = Resp>,Expand description
Runs the server with the provided service implementation. This function listens for incoming requests, processes them using the provided service, and sends back the responses. It uses the inherited file descriptors for communication.
§Arguments
serve- A mutable reference to the service implementation that handles the requests and generates the responses. The service must implement theServetrait with the appropriate request and response types.
§Type Parameters
Req- The type of the request messages. It must implementSerializeandDeserialize.Resp- The type of the response messages. It must implementSerializeandDeserialize.S- The type of the service implementation. It must implement theServetrait withReqas the request type andRespas the response type.
§Returns
A Result indicating the success or failure of the server execution. If the server runs
successfully, it never returns. If an error occurs, it returns an IpcError.
§Errors
This function returns an IpcError if any of the following conditions occur:
- The inherited file descriptors are not exactly two.
- An error occurs during the execution of the channel.