pub fn stream_new<'a>(&'a self, subreddits: Vec<&'a str>) -> impl Stream<Item = listing_response::Data> + 'a {
        let mut responses_so_far = HashSet::new();
        stream! {
            loop {
                for subreddit in &subreddits {
                    let response;
                    match Subreddit::build(subreddit.to_string(), self).new(&Default::default()).await {
                        Ok(whatever) => {response = whatever},
                        Err(e) => {panic!("Error streaming: {}", e)},
                    };
                    for entry in response.data.children {
                        // If it hasn't been seen yet
                        if responses_so_far.insert(entry.data.id.clone()) {
                            yield entry.data;
                        }
                    }
                    thread::sleep(time::Duration::from_secs(1));
                }
            }
        }
    }
/// Stream any new posts to any of the provided subreddits
/// There are significant limitations to this method:
///     - requests are made to each subreddit every 1s * subreddits.len()
///     - if traffic is sufficiently high (> 25 posts in 1s * subreddits.len()), posts will be skipped
Stream any new posts to any of the provided subreddits
There are significant limitations to this method:
requests are made to each subreddit every 1s * subreddits.len()
if traffic is sufficiently high (> 25 posts in 1s * subreddits.len()), posts will be skipped
Stream any new posts to any of the provided subreddits There are significant limitations to this method : requests are made to each subreddit every 1s * subreddits . len () if traffic is sufficiently high ( > 25 posts in 1s * subreddits . len () ) posts will be skipped
pub fn stream_new<'a>(&'a self, subreddits: Vec<&'a str>) -> impl Stream<Item = listing_response::Data> + 'a {
        let mut responses_so_far = HashSet::new();
        stream! {
            loop {
                for subreddit in &subreddits {
                    let response;
                    match Subreddit::build(subreddit.to_string(), self).new(&Default::default()).await {
                        Ok(whatever) => {response = whatever},
                        Err(e) => {panic!("Error streaming: {}", e)},
                    };
                    for entry in response.data.children {
                        // If it hasn't been seen yet
                        if responses_so_far.insert(entry.data.id.clone()) {
                            yield entry.data;
                        }
                    }
                    thread::sleep(time::Duration::from_secs(1));
                }
            }
        }
    }
pub fn stream_new < ' a > ( & ' a self , subreddits : Vec < & ' a str > ) -> impl Stream < Item = listing_response :: Data > + ' a { let mut responses_so_far = HashSet :: new ( ) ; stream ! { loop { for subreddit in subreddits { let response match Subreddit build ( subreddit to_string ( ) self ) new ( Default default ( ) ) await { Ok ( whatever ) { response whatever } Err ( e ) { panic ( " " e ) } } for entry in response data children { // If it hasn't been seen yet if responses_so_far insert ( entry data id clone ( ) ) { yield entry data } } thread sleep ( time Duration from_secs ( 1 ) ) } } } }
Stream any new posts to any of the provided subreddits
There are significant limitations to this method:
 requests are made to each subreddit every 1s * subreddits.len()
 if traffic is sufficiently high (> 25 posts in 1s * subreddits.len()), posts will be skipped
Stream any new posts to any of the provided subreddits There are significant limitations to this method : requests are made to each subreddit every 1s * subreddits . len () if traffic is sufficiently high ( > 25 posts in 1s * subreddits . len () ) posts will be skipped
&'a self
subreddits
Vec<&'a str>
&'a self
subreddits
Vec<&'a str>