pub struct ClusterConfig {
pub token: String,
pub intents: Intents,
pub shard_range: ShardRange,
pub gateway_url: String,
pub max_concurrency: usize,
pub large_threshold: u8,
}Expand description
Configuration for a Cluster.
Fields§
§token: StringBot token.
intents: IntentsGateway intents.
shard_range: ShardRangeWhich shards to manage.
gateway_url: StringGateway URL (usually from /gateway/bot).
max_concurrency: usizeMaximum concurrent identify operations (from /gateway/bot).
large_threshold: u8Large guild threshold.
Implementations§
Source§impl ClusterConfig
impl ClusterConfig
Sourcepub fn new(
token: impl Into<String>,
intents: Intents,
shard_range: ShardRange,
) -> Self
pub fn new( token: impl Into<String>, intents: Intents, shard_range: ShardRange, ) -> Self
Create a new cluster configuration.
Sourcepub fn with_max_concurrency(self, max_concurrency: usize) -> Self
pub fn with_max_concurrency(self, max_concurrency: usize) -> Self
Set the maximum concurrency (from /gateway/bot response).
Sourcepub fn with_gateway_url(self, url: impl Into<String>) -> Self
pub fn with_gateway_url(self, url: impl Into<String>) -> Self
Set the gateway URL.
Sourcepub async fn autoscaled(
token: impl Into<String>,
intents: Intents,
) -> Result<Self, GatewayError>
pub async fn autoscaled( token: impl Into<String>, intents: Intents, ) -> Result<Self, GatewayError>
Create a new cluster configuration with auto-detected shard count.
This requires the auto-sharding feature.
Trait Implementations§
Source§impl Clone for ClusterConfig
impl Clone for ClusterConfig
Source§fn clone(&self) -> ClusterConfig
fn clone(&self) -> ClusterConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ClusterConfig
impl RefUnwindSafe for ClusterConfig
impl Send for ClusterConfig
impl Sync for ClusterConfig
impl Unpin for ClusterConfig
impl UnwindSafe for ClusterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more