[][src]Trait twitchchat::WriterExt

pub trait WriterExt {
    fn join_many<'a, I, S>(&self, channels: I) -> Result<(), Error>
    where
        I: IntoIterator<Item = S> + 'a,
        S: AsRef<str> + 'a
;
fn join_many_limited<'a, I, S>(
        &self,
        channels: I,
        rate: Option<RateLimit>
    ) -> Result<(), Error>
    where
        I: IntoIterator<Item = S> + 'a,
        S: AsRef<str> + 'a
; }

Writer extensions

Required methods

fn join_many<'a, I, S>(&self, channels: I) -> Result<(), Error> where
    I: IntoIterator<Item = S> + 'a,
    S: AsRef<str> + 'a, 

Join a (huge) list of channels

This will efficiently partition all of the JOIN commands into max-sized messages

Ensuring the channel names are properly formatted and doing the least amount of actual writes as possible

use twitchchat::WriterExt as _;
let writer = client.writer();
writer
    .join_many(
        std::fs::read_to_string("active.txt")
            .unwrap()
            .split('\n')
            .map(str::trim),
    )
    .unwrap();

fn join_many_limited<'a, I, S>(
    &self,
    channels: I,
    rate: Option<RateLimit>
) -> Result<(), Error> where
    I: IntoIterator<Item = S> + 'a,
    S: AsRef<str> + 'a, 

Join a (huge) list of channels but using a RateLimit

Same as WriterExt::join_many, but takes in an optional RateLimit

If no rate limiter is provided then a default is used (50 channels per 15 seconds)

Loading content...

Implementors

impl<W: Write> WriterExt for Writer<W>[src]

Loading content...