#[non_exhaustive]pub enum Shards {
Auto,
Count(u32),
Range {
range: Range<u32>,
total: u32,
},
}Expand description
Which shards a Client runs (D-146).
A shard is one gateway connection; each carries the events of a part of the bot’s guilds.
Discord requires sharding from 2 500 guilds on and recommends a shard count in Get Gateway
Bot. Every shard runs in its own tokio task, and shards take turns identifying as Discord’s
max_concurrency allows.
discord.js counterpart: the shards and shardCount client options (where 'auto' is
opt-in; here it is the default).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auto
As many shards as Discord recommends, all in this process (the default).
Count(u32)
This many shards, all in this process.
Range
Only the shards numbered range out of total, to split a bot over several
processes.
Each process identifies its shards through its own queue, so start the processes one after another (or give them shards of different rate-limit buckets) to stay within Discord’s identify limit.
Trait Implementations§
impl Eq for Shards
impl StructuralPartialEq for Shards
Auto Trait Implementations§
impl Freeze for Shards
impl RefUnwindSafe for Shards
impl Send for Shards
impl Sync for Shards
impl Unpin for Shards
impl UnsafeUnpin for Shards
impl UnwindSafe for Shards
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more