[][src]Struct automate::sharding::ShardManager

pub struct ShardManager { /* fields omitted */ }

Helps setting up a bot with multiple shards.

Using this struct is probably not necessary and Automate::launch will do the work. The only reason to use this instead of Automate::launch would be if you want to spread the shards across multiple servers or if you wanted to have more or less shards than the amount recommended by Discord.

Implementations

impl ShardManager[src]

pub async fn with_config(config: Configuration) -> Result<ShardManager, Error>[src]

Creates a shard manager where all the shards will use the given config.

pub fn setup(&mut self, shard_id: u32)[src]

pub fn auto_setup(&mut self) -> &mut Self[src]

Sets up as many shards as Discord recommends.

pub async fn launch<'_>(&'_ mut self)[src]

Launches all the previously set up shards

pub fn recommended_shards(&self) -> u32[src]

The amount of shards recommended by discord

pub fn total_shards(&self) -> u32[src]

The amount of shards this bot will have. Defaults to the recommended shards value.

pub fn set_total_shards(&mut self, total_shards: u32) -> &mut Self[src]

Sets the amount of shards the bot will have.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,