How to set up Rust for Advent of Code

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 73

  • @cramhead
    @cramhead Рік тому +15

    Thanks for putting together this video. I’m looking forward to improving my rust skills with AoC. The tech stack lineup you put together looks like you’ll be presenting so really cool stuff. Looking forward to the series

  • @estark616
    @estark616 Рік тому +12

    I was just looking into this yesterday. Thank you for the detailed guidance, really helpful!!!!!

  • @justinkasteleijn119
    @justinkasteleijn119 Рік тому +7

    Thanks for the guide! First year of trying it in Rust. Previous iterations completed in C++, however seeing your implementations from last year inspired me to become a fellow Rustacean this year! Wishing you to best of luck!

  • @Mahmudul_Hasan92
    @Mahmudul_Hasan92 Рік тому +2

    Thank you so much for such a detailed and instructive video. Although I am not smart enough to go through AoC, at least by following others journeys and learning from them I might get prepared enough to take on the challenge next year on my own. Subscribed, will try to follow through the whole series.

  • @flwi
    @flwi 10 місяців тому

    That's an epic setup! Thanks for showing it.

  • @wojciech3094
    @wojciech3094 Рік тому +1

    I just wanted to thank you for your effort, your time and dedication.

  • @abroy77
    @abroy77 Рік тому

    literally exactly what i was looking for. love you man

  • @Jerry.Running
    @Jerry.Running Рік тому

    Thank you, I trying to learing about rust lang and your video will help me a lot.

  • @tenthlegionstudios1343
    @tenthlegionstudios1343 Рік тому

    Late to the party but I am so excited to follow this in real time this year. Last year, or 6 months ago, I followed your 2022 rust advent of code to learn rust. It was super useful! Excited for all the new inclusions this year, best advent of code channel I have found regardless of language :) .

  • @shrugalic
    @shrugalic Рік тому +1

    Cheers for the advanced guide, quite a few interesting tidbits in there!

  • @ngideo
    @ngideo Рік тому

    Thank you for this! I've been nervous about doing AoC in Rust, but knowing you're making these vids gives me great confidence that I'll at least be able to watch how you solved it!

  • @chrisbunge
    @chrisbunge Рік тому

    New to rust, picking it up as a hobby. Cool to see how I could've done it better after I completed my daily. Great video!

  • @JohnnyVestergaard73
    @JohnnyVestergaard73 Рік тому +4

    Hi Cris, couldn't help myself and converted part of your setup into a cargo-generate template...you now have the first pull-request for your AoC repo if you like it.

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +4

      wow, thanks! That's exactly what I wanted to do. Merged it in.

  • @ragectl
    @ragectl Рік тому

    I keep coming back to watch this video. It would be nice to explain some more of the context around your personal setup, why these are good things, using virtual workspaces, doing the debugging using dhat, etc.
    I see there is a video on using dhat,how to generate good benchmarks, but how it fits into the setup you chose 🤔

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      Yeah I could potentially do a recap video after Advent of Code about the setup, how it evolved and how different aspects worked out over the course of the days

    • @ragectl
      @ragectl Рік тому

      That would be great if you could. This is very practical application of a complex setup, so seeing what worked as expected, or what you changed is useful to learn about too 👍

  • @saminamanat
    @saminamanat Місяць тому

    it’s 2024 and this video is perfect

  • @MadMathMike
    @MadMathMike Рік тому +1

    Thanks for this content! I'm looking forward to finally learning some rust this year (I have been meaning to for a while now! 😅).
    Question: where are test modules normally kept in a Rust package? I assume putting the tests in the source code files was done just for convenience of Advent of Code, but I'm unsure. 🙂

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      tests being kept next to the source code is actually *not* an advent of code specific choice! This is a totally normal thing to do in regular projects for unit tests.
      Cargo supports unit tests, integration tests, examples, and doctests by default. unit tests are often handled like I have them here because they're meant to test isolated functions and such, while integration tests are typically in the tests/ directory. examples can live in the examples/ directory and even examples inside of documentation can be tested.
      * doc.rust-lang.org/cargo/reference/cargo-targets.html#tests
      * doc.rust-lang.org/book/ch11-03-test-organization.html
      * doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html
      * doc.rust-lang.org/cargo/reference/cargo-targets.html?highlight=bin#examples

  • @kentbowling7513
    @kentbowling7513 Рік тому

    Awesome beginner advice for setting up for AoC, and I can't wait to look at your eventual "kitchen sink" workspace 👍

  • @machinima1402
    @machinima1402 Рік тому +1

    Holy, i woke up for this

  • @onestack-fr7ue
    @onestack-fr7ue Рік тому +1

    Holy f, thats insane 😂 thanks for sharing

  • @coreyfro
    @coreyfro Рік тому +1

    You read my mind

  • @TheLazy657
    @TheLazy657 Рік тому

    Hey hey,
    first of all thanks for the videos.
    I'm new to Rust and the AOC videos have helped me a lot accelerating my learning experience.
    I'm also using Linux for a while now and got very curious about the `ls`, `ps` and `where` you are using, since they are not the default.
    Could you give me a hint on whats going on there?

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      I use nushell as my primary shell (instead of bash/zsh/etc) and the ls, etc are from there. www.nushell.sh/

  • @funkdefied1
    @funkdefied1 Рік тому

    Looks good! Did you consider putting your error definition and other boilerplate in a workspace-level library?

    • @chrisbiscardi
      @chrisbiscardi  Рік тому

      Yeah, I decided against it because I want an individual error for each day without needing to worry about breaking other days.

  • @adamduvick
    @adamduvick Рік тому

    Thanks for this! What OS and Window Manager do you use? I really like the clean look you have setup.

  • @abbcc555
    @abbcc555 Рік тому +51

    "..potentially do it in Rust. That means you have 25 problems.." you definitely have 26 problems right there :D

  • @endogeneticgenetics
    @endogeneticgenetics Рік тому

    So excited by this. I had no intention of doing AoC this year. But I'm super interested to learn better profiling techniques and curious to see how miette shapes up!

  • @0xh8h
    @0xh8h Рік тому +2

    which editor are you using? It looks like VSCode but the theme is not familiar

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      its vscode with nightowl and a bunch of custom settings that modify the UI, mostly to just remove things.

  • @tmnt9001
    @tmnt9001 Рік тому +1

    Why do part1.rs and part2.rs have to be in a bin directory?

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +3

      Placing binaries in src/bin is a convention that is supported by cargo. It means that I can run them with `cargo run --bin part1` without any additional work because cargo will auto-discover them.
      If they weren't in src/bin (and weren't in main.rs, which is the primary default location), then I would have to configure their location.
      Basically, you can customize the location of any binaries but I chose to use the default locations.
      doc.rust-lang.org/cargo/reference/cargo-targets.html

  • @morgomi
    @morgomi Рік тому

    thank you!!

  • @GuillaumeLudwig
    @GuillaumeLudwig Рік тому +3

    I'm sorry this is unrelated to the content of this video, but you seem to use MacOS and I don't know you you got this look (window disposition, no border, etc). Could you please explain it ? I have something like that with Hyprland on Linux and I wanted something similar on my Mac.

    • @arinonono
      @arinonono Рік тому +2

      I think he's using Yabai

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +2

      I use yabai github.com/koekeishiya/yabai with the bsp layout and I turn window shadows off, etc.

    • @GuillaumeLudwig
      @GuillaumeLudwig Рік тому

      Yabai seems really nice, thanks for the share !

  • @dshko28
    @dshko28 Рік тому

    Out of curiosity, why do you prefer vscode over vim? I see many Rust programmers using the latter.

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +2

      more people use vscode, which makes my videos more accessible to more people.

  • @MasterHigure
    @MasterHigure Рік тому +1

    06:40 There is only one input each day. There is never any input2.
    That being said, this looks a whole lot more involved than your setup last year. I'm kinda jealous.

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +3

      I couldn't remember if there was an input2, so I set it up to work. Plus this means that I can drop random data into the two input files without messing up the other part if I'm debugging.
      Its definitely more involved than last year. I thought about it and felt that having it all set up was going to be better than doing the setup ad-hoc because people would be able to see the tools being used and have some more context before I explained them when they came up.

  • @Metruzanca
    @Metruzanca Рік тому

    I'm unsure if I wanna do it in Rust or Ocaml....

  • @gunnarbernstein9363
    @gunnarbernstein9363 Рік тому

    Great idea to have a setup lesson. Enjoyed it. Being a non-native speaker and a Rust beginner, you speak and act a bit fast for me. Pause and Repeat is my friend.

  • @emillindholmbrandt
    @emillindholmbrandt Рік тому

    What color scheme are you using for VSCode?

  • @ColinCheungGG
    @ColinCheungGG Рік тому

    Should probably have spoken about how to install rust at the very start

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      I could have, but the instructions on the official rust site are good.

  • @n.a.s1096
    @n.a.s1096 Рік тому

    What color theme are you using??

  • @pabloqp7929
    @pabloqp7929 Рік тому

    OP your _ls_ looks like an alias innit? Very cool looking output, what is the actual command? Not eza either I believe

    • @chrisbiscardi
      @chrisbiscardi  Рік тому

      I use nushell, which comes with a structured ls output that displays as a table

    • @pabloqp7929
      @pabloqp7929 Рік тому

      @@chrisbiscardi cool stuff thanks, cheereo

  • @nullzeon
    @nullzeon Рік тому

    Don't know why this kept bothering me, but line 6 in your justfile didn't have a space between +nightly and leptos

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      Yeah it's fixed already, but thanks for the heads up

  • @pabloqp7929
    @pabloqp7929 Рік тому

    🎉

  • @Crappycrabby
    @Crappycrabby Рік тому

    Damn what colorscheme is this? Looks like something I am looking for

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +1

      The theme is Night Owl by sarah.drasner. I use it for vscode and iterm2.

  • @Oysy
    @Oysy Рік тому

    Which browser is that?

  • @falcon20243
    @falcon20243 Рік тому

    This year went away so fast.

  • @perasuperAA
    @perasuperAA Рік тому

    1 file per 1 day!!

  • @Gers217
    @Gers217 Рік тому +3

    E

    • @Gers217
      @Gers217 Рік тому

      As a rustacean it saddens me that I didn't get a heart

  • @zahash1045
    @zahash1045 Рік тому +1

    Don’t you feel your setup is over complicated for something as simple as advent of code?
    Sucks the joy out of programming

    • @chrisbiscardi
      @chrisbiscardi  Рік тому +13

      yes, I am focused on teaching Rust and not getting on the leaderboard or just solving the problems.
      I do feel that my personal setup is complicated but it doesn't feel over complicated for what I'm trying to do: which is to show how to use a variety of tools and language features both to solve the problems and gain insight into what a program is actually doing (runtime, heap usage, etc). On day 1 this will seem especially complicated because day 1 is usually close to a one-liner. It becomes more useful as the weeks go on.
      This setup does not suck the joy out of programming for me. I quite enjoy being able to use the additional information provided by these tools and tasks like writing tests doesn't feel like a chore to me.
      The part that I find tedious is, for example, when I went to set up the Tracy profiler this year. The documentation for Tracy comes as a PDF download, and none of the available client libraries seem to include documentation for how to use them. So now I have to read the whole PDF and understand a lot more before I'm even able to collect any profiling information using Tracy. That said, I know that if I ran into this problem, then other people will too, and if I found it tedious then a beginner will likely find it close to impossible... and something I *do* enjoy is figuring that tedious thing out and documenting it somewhere so people can use the tool.

    • @kentbowling7513
      @kentbowling7513 Рік тому +1

      I don't think he's expecting everyone to do what he's doing near the end of this video. The first part of this video has an appropriate amount of "complication" (it's really not that complicated). That looks like a very good setup if you want to use Rust to do the AoC problems.
      The 2nd part of this video will be interesting to look at later, and is more "software engineering" than "pure hacking fun". I can imagine him going back and showing algorithm improvements based upon issues identified in benchmarks, and it looks like he's setting it up for potential educational purposes later.