[][src]Struct twitch_irc::ClientConfig

pub struct ClientConfig<L: LoginCredentials> {
    pub login_credentials: L,
    pub max_channels_per_connection: usize,
    pub max_waiting_messages_per_connection: usize,
    pub time_per_message: Duration,
    pub connection_rate_limiter: Arc<Semaphore>,
    pub new_connection_every: Duration,
}

Configures settings for a TwitchIRCClient.

Fields

login_credentials: L

Gets a set of credentials every time the client needs to log in on a new connection. See LoginCredentials for details.

max_channels_per_connection: usize

A new connection will automatically be created if a channel is joined and all currently established connections have joined at least this many channels.

max_waiting_messages_per_connection: usize

A new connection will automatically be created if any message is to be sent and all currently established connections have recently sent more than this many messages (time interval is defined by max_waiting_messages_duration_window)

time_per_message: Duration

We assume messages to be "waiting" for this amount of time after sending them out, e.g. typically 100 or 150 milliseconds (purely a value that has been measured/observed, not documented or fixed in any way)

connection_rate_limiter: Arc<Semaphore>

rate-limits the opening of new connections. By default this is constructed with 1 permit only, which means connections cannot be opened in parallel. If this is set to more than 1 permit, then that many connections can be opened in parallel.

This is designed to be wrapped in an Arc to allow it to be shared between multiple TwitchIRCClient instances.

new_connection_every: Duration

Allow a new connection to be made after this period has elapsed. By default this is set to 2 seconds, and combined with the permits=1 of the semaphore, allows one connection to be made every 2 seconds.

More specifically, after taking the permit from the semaphore, the permit will be put back after this period has elapsed.

Implementations

impl<L: LoginCredentials> ClientConfig<L>[src]

pub fn new_simple(login_credentials: L) -> ClientConfig<L>[src]

Create a new configuration from the given login credentials, with all other configuration options being default.

Trait Implementations

impl<L: Debug + LoginCredentials> Debug for ClientConfig<L>[src]

impl Default for ClientConfig<StaticLoginCredentials>[src]

Auto Trait Implementations

impl<L> !RefUnwindSafe for ClientConfig<L>

impl<L> Send for ClientConfig<L>

impl<L> Sync for ClientConfig<L>

impl<L> Unpin for ClientConfig<L> where
    L: Unpin

impl<L> !UnwindSafe for ClientConfig<L>

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, U> Into<U> for T where
    U: From<T>, 
[src]

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.