Function create_recommended

Source
pub async fn create_recommended<F, Q>(
    client: &Client,
    config: Config<Q>,
    per_shard_config: F,
) -> Result<impl ExactSizeIterator<Item = Shard<Q>>, StartRecommendedError>
where F: Fn(ShardId, ConfigBuilder<Q>) -> Config<Q>, Q: Clone,
Available on crate feature twilight-http only.
Expand description

Create a range of shards from Discord’s recommendation.

Passing a primary config is required. Further customization of this config may be performed in the callback.

Internally calls create_iterator with the values from GetGatewayAuthed.

§Errors

Returns a StartRecommendedErrorType::Deserializing error type if the response body failed to deserialize.

Returns a StartRecommendedErrorType::Request error type if the request failed to complete.

§Panics

Panics if loading TLS certificates fails.