Git Product home page Git Product logo

adventofcode-starter's Introduction

Advent of Code Starter Project - Rust

This repository contains a starter Rust project to use with Advent of Code. This has none of the solutions to the puzzles, but includes some basic bootstrapping (i.e. reading the input file) and sets up a way to select the puzzle to execute.

There is also a basic shell for Day 1 to show how the interface works.

Getting started

  1. Make sure you have Rust installed and set up with your IDE. I'm a big fan of Visual Studio Code for Rust, and use the Rust extension, but you can check out other tools for your favourite IDE.
  2. If you're just starting out with Rust, I recommend checking out the Rust book, but there are other Rust-based resources out there that might be more your style! Another popular place to get support is r/LearnRust, and there are books from big publishers like O'Reilly, and videos from platforms like PluralSight that can help
  3. If you would like to use external packages (which Rust calls 'crates'), you can check out crates.io to search, and docs.rs for documentation. For most of the 'standard' things, there is also a community-maintained list of recommended packages available at blessed.rs
  4. Check out the Advent of Code day 1 problem, and start writing your solution in the day one source file
  5. Update the LICENSE file with your name

Getting your results

  1. Add a call to your solution in src/main.rs
  2. Run cargo run -- <day> for part 1, cargo run -- <day> -p 2 for part 2. If you'd like to select your input file, you can also do so with -f <file>
  3. Your output should be shown as the last line of text!

Run cargo run -- --help from the command line to see the documentation for the CLI.

What's included in this?

  1. A main.rs binary including:
    • Basic CLI parsing (pick puzzle, puzzle part, and input file location) with clap
    • Input file reading and passing to your solution
    • Basic logging setup (with tracing) - OPTIONAL
    • Basic metrics setup - OPTIONAL
    • Puzzle solution output
  2. A lib.rs that references the day_one module.
  3. A bare-bones day_one.rs.
  4. A basic Github Actions workflow file for running automated tests

Opting out of logging/timing setup

If you do not want to use the included logging setup or the solution metrics, you can disable these by disabling the relevant feature flags in Cargo.toml. To do so, remove the feature flags you do not want to use from the defaults line, under features, like so:

[features]
default = []
logging = ["tracing", "tracing-subscriber"]
metrics = []

This will prevent the optional dependencies from being compiled, and will not enable the additional functionality associated with these features.

adventofcode-starter's People

Contributors

cryptaliagy avatar

Stargazers

 avatar Ara Kirijian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.