daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Jan 13th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use futures::{stream, prelude::*};
  2.  
  3. fn main() {
  4.     let tweet_stream = stream::empty::<Tweet, ()>();
  5.  
  6.     tweet_stream.map(|tweet| {
  7.          let parts = to_parts(&tweet.text);
  8.         (tweet, parts)
  9.     });
  10. }
  11.  
  12. pub fn to_parts(string: &str) -> Vec<Part> {
  13.     string.split(' ').map(|s| Part::Word(s)).collect()
  14. }
  15.  
  16. #[derive(Debug, PartialEq)]
  17. pub enum Part<'a> {
  18.     Word(&'a str),
  19.     Whitespace(&'a str),
  20. }
  21.  
  22. pub struct Tweet {
  23.     pub id: String,
  24.     pub text: String
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top