pub fn stream_historical(&'a self) -> impl Stream<Item = listing_response::Data> + 'a {
    stream! {
      let mut query_parameters = listing_request::New { ..Default::default() };
      let mut page_of_posts = match self.new(&query_parameters).await {
        Ok(response) => response,
        Err(e) => panic!("An error ocurred: {}", e),
      };

      for existing_post in page_of_posts.data.children {
        yield existing_post.data;
      }

      let mut after = page_of_posts.data.after;
      thread::sleep(time::Duration::from_secs(1));

      while let Some(next_after) = after {
        query_parameters = listing_request::New {
          after: next_after,
          ..Default::default()
        };

        page_of_posts = match self.new(&query_parameters).await {
          Ok(response) => response,
          Err(e) => panic!("An error ocurred: {}", e),
        };

        after = page_of_posts.data.after;
        for existing_post in page_of_posts.data.children {
          yield existing_post.data;
        }

        thread::sleep(time::Duration::from_secs(1));
      }
    }
  }
/// Create a stream of the most recent ~1000 posts, from newest to oldest. The stream will
/// terminate once all available posts have been emitted.
Create a stream of the most recent ~1000 posts, from newest to oldest. The stream will
terminate once all available posts have been emitted.
Create a stream of the most recent ~1000 posts from newest to oldest . The stream will terminate once all available posts have been emitted .
pub fn stream_historical(&'a self) -> impl Stream<Item = listing_response::Data> + 'a {
    stream! {
      let mut query_parameters = listing_request::New { ..Default::default() };
      let mut page_of_posts = match self.new(&query_parameters).await {
        Ok(response) => response,
        Err(e) => panic!("An error ocurred: {}", e),
      };
      for existing_post in page_of_posts.data.children {
        yield existing_post.data;
      }
      let mut after = page_of_posts.data.after;
      thread::sleep(time::Duration::from_secs(1));
      while let Some(next_after) = after {
        query_parameters = listing_request::New {
          after: next_after,
          ..Default::default()
        };
        page_of_posts = match self.new(&query_parameters).await {
          Ok(response) => response,
          Err(e) => panic!("An error ocurred: {}", e),
        };
        after = page_of_posts.data.after;
        for existing_post in page_of_posts.data.children {
          yield existing_post.data;
        }
        thread::sleep(time::Duration::from_secs(1));
      }
    }
  }
pub fn stream_historical ( & ' a self ) -> impl Stream < Item = listing_response :: Data > + ' a { stream ! { let mut query_parameters listing_request New { Default default ( ) } let mut page_of_posts match self new ( query_parameters ) await { Ok ( response ) response Err ( e ) panic ( " " e ) } for existing_post in page_of_posts data children { yield existing_post data } let mut after page_of_posts data after thread sleep ( time Duration from_secs ( 1 ) ) while let Some ( next_after ) after { query_parameters listing_request New { after next_after Default default ( ) } page_of_posts match self new ( query_parameters ) await { Ok ( response ) response Err ( e ) panic ( " " e ) } after page_of_posts data after for existing_post in page_of_posts data children { yield existing_post data } thread sleep ( time Duration from_secs ( 1 ) ) } } }
Create a stream of the most recent ~1000 posts, from newest to oldest.
Create a stream of the most recent ~1000 posts from newest to oldest .
&'a self
&'a self