Coder Social home page Coder Social logo

rust-cheatsheet's Introduction

Rust Cheatsheet

Abridged Rust by Example.

This repo provides a set of examples for getting quickly acquainted with the Rust programming language given some experience in software development.

This software is licensed under the Apache 2.0 software license (see LICENSE file). Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

The author of this software makes no representation or guarantee that this software (including any third-party libraries) will perform as intended or will be free of errors, bugs or faulty code. The software may fail which could completely or partially limit functionality or compromise computer systems. If you use or implement the software, you do so at your own risk. In no event will the author of this software be liable to any party for any damages whatsoever, even if it had been advised of the possibility of damage.

To get started, just jump through the files in the repo as needed.

Quick tips

  • A lambda expression in called a closure in Rust.

  • format! is print! but writes to heap if you want to store the string.

  • x? is shorthand for try!(x)

  • Underscores can be used for numeric readability: 1_000 is the same as 1000, and 0.000_001 is the same as 0.000001

  • Struct is like a dict. Enums are structs which take one of the types in the enum.

  • Signed integer example: 128 as i8 = -128 because there are 256 values, 128 negative, 127 positive, and 0. 256 as i8 = 0 because w wrapped round -128 and added another 128 to get 0. 384 as i8 = -128. It works like modular arithmetic.

rust-cheatsheet's People

Contributors

theoturner avatar

Forkers

takertao2

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.