Giter Site home page Giter Site logo

areski / rust-by-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rust-lang/rust-by-example

0.0 3.0 0.0 6.64 MB

Learn Rust with practical examples

Home Page: http://rustbyexample.com

License: Apache License 2.0

Shell 1.21% Rust 98.79%

rust-by-example's Introduction

Build Status

Rust by Example

What's this?

This is the source code of the Rust by example website!

How to contribute

See CONTRIBUTING.md.

How to generate the static site

We use these tools to generate the static site:

gitbook will generate the site from markdown files (see details about how it works here).

Before running gitbook, we do a preprocessing step using src/update.rs.

This preprocessing has two steps:

Generating the SUMMARY.md

SUMMARY.md is generated from the examples/structure.json file. This JSON file contains a tree-like structure of "examples".

Each example has:

  • an id, e.g. hello
  • a title, e.g. Hello World
  • optionally, children, which is a vector of sub-examples, e.g. null
  • a directory under examples, e.g. examples/hello
  • an entry in examples/structure.json, e.g. { "id": "hello", "title": "Hello World", "children": null }
  • some source file(s), e.g. examples/hello/hello.rs
  • an input markdown file, e.g. examples/hello/input.md

When dealing with a child example, the path will have to include the id of its ancestors; e.g. examples/variable/mut/input.md, implies that a mut example lives under the variable example.

Processing input.md

Instead of including the rust code directly in input.md, the code lives in separate source files; and the preprocessing step will insert the source code in the markdown file.

For example, to insert the source code of the hello.rs file, the following syntax is used in the markdown file:

  • {hello.play} expands the source code embedded in a live code editor
  • {hello.rs} expands to static/plain source code.
  • {hello.out} expands to the output of executing the source code.

The Makefile provides the following recipes:

  • make: builds update.rs and does the preprocessing step
  • make book: runs gitbook to generate the book
  • make serve: runs gitbook --serve to generate the book and publishes it under localhost:4000
  • make test: will check all the rust source files for compilation errors

License

Rust by example is dual licensed under the Apache 2.0 license and the MIT license.

See LICENSE-APACHE and LICENSE-MIT for more details.

rust-by-example's People

Contributors

abonander avatar alco avatar allenap avatar alxgnon avatar aorazaev avatar arethusa26 avatar brianloveswords avatar crimsonvoid avatar drothlis avatar eduardobautista avatar emkay avatar gilles-leblanc avatar gmiroshnykov avatar henrikh avatar ivanukhov avatar jacob-hegna avatar jakejscott avatar janc13 avatar justanotheranonymoususer avatar maxd avatar mdinger avatar nodakai avatar orium avatar raydiation avatar robinst avatar tjkierzkowski avatar ubsan avatar vks avatar vojtechkral avatar xiaq avatar

Watchers

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