pub async fn serve<R: ConnectionRouter>(
config: GatewayConfig,
identity: Identity,
build: impl FnOnce(&RuntimeHandle) -> R,
) -> Result<()>Expand description
Bind, create shards, and serve, in one call.
The shape most composition binaries want. build runs after the sockets are
bound and before the first connection is accepted, which is the only window
in which “the initial shards exist before anyone can be routed to one” is
guaranteed.
§Errors
Whatever Gateway::bind or Gateway::serve report.