Giter Club home page Giter Club logo

rustbook's Introduction

Rust Book Examples

This is an attempt to run all the example code from the Rust Book.

All of the code is in separate folders. The first level is the chapter number, with a leading zero, like ch02 for examples in chapter 2. Inside, the sub-examples are named with the chapter and an ordinal, and then the name of the example, like ch1_3_hello_cargo.

I use underscores instead of periods in the folder names because Rust does not like periods in folder names.

To avoid the goofy ch* stuff on the executable, edit the Cargo.toml file in the project folder to set the package name to something sensible.

To build, go to the root directory and run:

cargo build

It will build all the projects.

To run a project, run:

cargo run --bin nameofexecutable

Note that all the projects will get built in the target folder in the root. Hopefully, none of the examples will have duplicate names.

To add a project to the build, edit the Cargo.toml file in the root, and add the path to the members array.

To run a project using the tasks.json config in Visual Studio Code, set the path to the project to the default-members array in the root Cargo.toml. Even though it is an array, I'm only putting one thing in there.

rustbook's People

Contributors

barbellfan avatar

Watchers

 avatar  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.