Function vfs::service::host

source ยท
pub fn host<ServerRequestStream, CreateServer, Task>(
    create_server: CreateServer,
) -> Arc<Service>
where ServerRequestStream: RequestStream, CreateServer: Fn(ServerRequestStream) -> Task + Send + Sync + 'static, Task: Future<Output = ()> + Send + 'static,
Expand description

Constructs a node in your file system that will host a service that implements a statically specified FIDL protocol. ServerRequestStream specifies the type of the server side of this protocol.

create_server is a callback that is invoked when a new connection to the file system node is established. The connection is reinterpreted as a ServerRequestStream FIDL connection and passed to create_server. A task produces by the create_server callback is execution in the same ExecutionScope as the one hosting current connection.

Prefer to use this method, if the type of your FIDL protocol is statically known and you want to use the connection execution scope to serve the protocol requests. See endpoint for a lower level version that gives you more flexibility.