• 29 Posts
  • 752 Comments
Joined 3 years ago
cake
Cake day: November 24th, 2023

help-circle
  • Most of the time, async tutorial makes you learn tokio, not async. If your program can run with only tokio::main, then you learned async. If not, you learnt tokio (except if you are spawning a future that should never stop)

    For example, my pet project only uses tokio::main to do async stuff. The only instances of tokio::spawn is make sure some SQLite transactions get polled to completion. I do need to replace them with a proper mechanism now that sqlx supports smol-rs


  • A lot of the time it’s not about options. It’s about not messing up the async pattern.

    If you have something that either:

    • requires a lot of CPU time
    • requires to run permanently, independently to the caller’s future polling. Then you can spawn it on a global tokio executor.

    If not, just use future polling tricks like the futures::join!() macro or a stream with .buffered(). It won’t be slower. The bottle neck is IO. Not the program.

    Personally I even try to replace the heavy reqwest library with ureq + blocking, and it works perfectly and compiles faster (you can see that in the api_bindium crate)






  • Tbh the borrow checker isn’t a problem for 75% of cases. If you actually need the performance/memory optimization then yes you will have to deal with it… Otherwise just .clone()

    And if you find the borrow checker annoying in async rust, that’s mostly a tokio issue. Look into smol-rs as it offers alternatives

    If you want real cons…

    • Compile times
    • easy build time arbitrary code execution
    • trait bounds spaghetti

  • Quelques petits points que tu peux regarder si tu veux aller plus loin:


    Pour contrôler ton docker à distance, tu peux utiliser Komodo. Tu peux ajouter n’importe quel stack a partir d’une interface web


    Syncthing n’est pas un logiciel de backup, mais de duplication. Meme avec les options de backup, c’est pas super.

    Si tu veux un logiciel un peu plus robuste, tu peux voir Borg backup (avec son GUI vorta), restic (GUI backrest) ou Urbackup.


    Pour la musique je te conseille de tagger tes fichiers avec MusicBrainz picard. Ça te permet d’améliorer les métadonnées sur Navidrome, et avoir les pochettes d’albums.


    Si les playlists et stats de Spotify te manque, tu peux utiliser ListenBrainz pour envoyer tes écoutes, et générer des playlists. Tu peux même écouter tes fichiers sur navidrome apartir de ListenBrainz.

    Malheureusement il n’y a pas d’option native pour envoyer les playlists sur navidrome, mais tu peux utiliser Alistral pour ça