1. 26

  2. 14

    I could never find a file watcher that exactly fit all my needs, so I decided to learn Rust by writing one.

    If you have any ideas for feature requests or other feedback, please let me know!

    1. 7

      I love projects like this. I made a little .gitignore fetcher in Rust for giggles a few months back.

      Could you elaborate on how you liked the experience overall? Likes/dislikes?

      1. 6

        I really enjoyed using Rust for this project. It fit well into what I wanted it to do, and distribution of the final binary is easy.

        Getting to a point where I felt like I could use Rust took longer than I thought I would. New users have to come to grips with the borrow checker (and Rust’s idea of move semantics), ownership, and whatnot. I was stymied by lifetimes for awhile, and then just got rid of them because I didn’t really need them to continue. The compiler is a bit slow, but the dev/compiler UX is excellent. The default warning level is appropriate for a PL that cares about correctness. Requiring totality is an excellent choice.

        The ecosystem had way more packages than I thought it would, and they were generally very good. The main crate I rely on, notify, Just Worked from the start. (I’ve yet to see a fantastic C lib that does what it does). I had some trouble with another crate, but ended up coding the functionality for it myself. That ended up being way more fun and educational, anyway! Most of the libraries seem very sensible and reasonable. I especially like that some libraries have optional features you can opt-out of to reduce build time if you aren’t using them.

        I had a few qualms with Rust itself, but most of it comes down to the fact that Rust is meant to work well as a low-level language, and I wanted it to be a higher-level one. Rust has a Path struct that represents a filesystem path on a particular OS. Because the representation of the Path might not be the same as Rust’s str type, you must convert back and forth when using them. Along with this point, you can’t create a higher-level construct (e.g. Maybe) that handles this for you, you instead use the try! macro or something similar. At times, it can feel unwieldy to lift the unwrap()’s out, even if they probably shouldn’t be there. On a related note, it’d be really nice if the compiler could derive From impls, as functions often end up producing more than one type of error.

        I don’t find writing in Rust to be particularly inspiring, at least not in the same way as Haskell. But that’s not really fair to Rust, as Rust tries to occupy the nasty world that C inhabits without all the badness. In a past life, I did a bunch of low-level hardware stuff with C. Were I tasked with that again, I’d definitely reach for Rust over C/C++ for that stuff. I’d also consider Rust for ‘mid-level’ projects like this one, especially if I needed to distribute self-contained binaries.

        1. 3

          Sounds similar to my experience of it.

          I’d happily use it in place of C/C++, but larger applications I’d lean Haskell if GC can be tolerated or I don’t need ez-pz cross-compilation.


    2. 1

      entr is well designed to integrate with other tools, e.g. tmux and ag: https://lubomir.github.io/en/2016-09-05-introducing-entr.html