Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ghost
    @ghost~6187be106da03739848a0162
    In this case Heading Two?
    Devin R
    @devinr528:matrix.org
    [m]
    Some is
    enum Option<T> {
        Some(T),
        None,
    }
    tanriol
    @tanriol:matrix.org
    [m]
    println!("payload: \"{}\"", &captures[1]);
    Ghost
    @ghost~6187be106da03739848a0162
    Just tried it, worked beautifully! Thank you :heart:
    Vaimer9
    @Vaimer9
    new to gitter
    what even is this
    tanriol
    @tanriol:matrix.org
    [m]
    A chat system on the Internet designed to provide chat space for Github users. This room is not very popular :-)
    1 reply
    Ghost
    @ghost~6187be106da03739848a0162
    Discord for devs?
    Or what @tanriol said.
    Vaimer9
    @Vaimer9
    discord is just as better
    tanriol
    @tanriol:matrix.org
    [m]
    There are people who don't like Discord :-)
    Ghost
    @ghost~6187be106da03739848a0162
    The pink-haired crying girl agrees.🦀
    522
    @r522:matrix.org
    [m]
    that and the two discords
    Ghost
    @ghost~6187be106da03739848a0162
    Quick question:
    fn main() {
        println!("\u{1f600}");
    }
    Why does this render a grinning smiley face?
    And this:
    pool.insert(String::from("prideFlag"), String::from("\u{1f3f3}");
        pool.insert(String::from("transFlag"), String::from("\u{26a7}");
        pool.insert(String::from("rainbow"), String::from("\u{1f308}");
        pool.insert(String::from("peopleKissing"), String::from("\u{1f48f}");
        pool.insert(String::from("party"), String::from("\u{1f389}");
        pool.insert(String::from("coupleHeart"), String::from("\u{1f491}");
        pool.insert(String::from("sparkles", String::from("\u{2728}");
        pool.insert(String::from("confetti"), String::from("\u{1f38a}");
        pool.insert(String::from("maleBunnies"), String::from("\u{1f46f}");
        pool.insert(String::from("kiss"), String::from("\u{1f48b}");
    And if I put this in a HashMap, yield a token error?
    Does it have something to do with }?
    Ghost
    @ghost~6187be106da03739848a0162
    Actually never mind. The slew of errors confused me.
    Panicked.
    My apologies.
    Ghost
    @ghost~6187be106da03739848a0162
    I'm trying to import this one function.
    One file with:
    pub fn do_something() {
              println!("Do something.");
    }
    Into a file called lib.rs.
    How do I do this?
    mod crabmoji;
    use crabmoji::emoji_pool;
    #[cfg(test)]
    mod tests {
        #[test]
        fn print_all_emojis() {
            let pool = emoji_pool();
            for (key,value) in pool.into_iter() {
                let emoji_name = key.to_owned();
                let emoji = pool.get(emoji_name);
                println!("{} : {}", emoji_name, emoji);
            }
        }
    }
    Because this in't working.
    I have one file called crabmoji.rs.
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    if its in the lib.rs it would possibly be
    use crabmoji::do_something

    if you have the file lib.rs and crabmoji.rs then you possibly need to import the mod first
    lib.rs

    mod crabmoji;
    use crabmoji::do_something;
    
    you can use do_something() any function here.
    
    #[cfg(test)]
    mod tests {
        use crate::crabmoji::do_something;
        #[test]
        fn print_all_emojis() {
            let pool = emoji_pool();
            for (key,value) in pool.into_iter() {
                let emoji_name = key.to_owned();
                let emoji = pool.get(emoji_name);
                println!("{} : {}", emoji_name, emoji);
            }
        }
    }

    crabmoji.rs

    pub fn do_something() {
              println!("Do something.");
    }
    Ghost
    @ghost~6187be106da03739848a0162
    And if I wanted to use it in the "tests" mod?
    That's the problem.
    "do_something" = "emoji_pool" in "lib.rs".
    Ahhhh hang on, you wrote it! Let me try that!
    Ghost
    @ghost~6187be106da03739848a0162
    Final question: Is this legit? Should I publish it to crates.io?
    Ghost
    @ghost~6187be106da03739848a0162
    Just asking. A little Rustacean crab clicking its pincers happily. :heart:
    :crab: :unicorn:
    Ghost
    @ghost~6187be106da03739848a0162
    @baloo I didn't know bears liked crabs? Gotta say though, bears are one of my favourite animals. :bear: :heart:
    :bear: hug for you.
    Ghost
    @ghost~6187be106da03739848a0162
    For Mr. Blenstrup-Pedersen: That worked. Thank you so f*cking much!
    Dirk Van Haerenborgh
    @vhdirk:matrix.org
    [m]
    Hi! quick question:
    I have implemented future::Stream for a socket; do I have to implement this as well? https://docs.rs/futures/0.3.18/futures/stream/trait.TryStream.html
    Luis Yanes
    @yanesl:matrix.org
    [m]

    Hi, I'm learning rust and was wondering if someone could give me a hand in walking an iterator by adjacent pairs. I'm trying to do the following:

    num_it.zip(num_it.skip(1))

    but I am getting a use after move error. I was wondering what is the best way of doing this?

    tanriol
    @tanriol:matrix.org
    [m]
    If the iterator you're using can be cloned, you can clone it. Alternatively, if you're working with a slice, you can use windows
    itertools has tuple_windows for the iterator case.
    Devin R
    @devinr528:matrix.org
    [m]
    And since Vec<T> derefs to [T] (slice of T) you get all of slices methods for free (think inheritance but not).