Coder Social home page Coder Social logo

awesome-rust's Introduction

Rust (プログラミング言語)

Rust

Rust programming language black logo.svg

  • パラダイム 並列計算、関数型、オブジェクト指向、命令型プログラミング、構造化、静的型付け

  • 登場時期 2010年

  • 設計者 グレイドン・ホアレ

  • 開発者 Rust Project Developers

  • 最新リリース 1.15[1] / 2017年2月2日(2日前)

  • 型付け 静的型付け、強い型付け、型推論、構造化データ

  • 主な処理系 rustc

  • 影響を受けた言語 Alef, C++, Camlp4, Common Lisp, Erlang, Haskell, Hermes, Limbo, Napier, Napier88, Newsqueak, NIL, Sather, -Standard ML

  • 影響を与えた言語 Swift

  • プラットフォーム FreeBSD, Linux, macOS, Windows

  • ライセンス MIT

  • ウェブサイト rust-lang.org

  • 拡張子 .rs .rlib


Rust(ラスト)は並列かつマルチパラダイムのプログラミング言語である。Mozillaによって開発されている[2]。関数型プログラミング、並列アクターモデル、手続き型プログラミング、オブジェクト指向プログラミングをサポートする実用的な言語を目指している。

目次

-1 概要 -2 特徴 -3 プログラム例 -3.1 Hello World -3.2 階乗 -4 言語の発展 -5 脚注 -6 外部リンク

概要

主任開発者はグレイドン・ホアレ[3]である。彼は2006年にこの言語の開発に着手し、Mozillaが関わりはじめたのは2009年で[4]、2010年のモジラ・サミットで公に姿を表した[5]。初期のコンパイラーはOCaml言語で作られていたが、2010年にはコンパイラーをRust言語自身で作る作業が開始された[6]。翌年には最初の完動品が作成された[7]。このコンパイラーはLLVMで構築された。

  • Rustコンパイラーの第0.1版は2012年1月に完成している[8]。モジラはこれを新しいモノ好みの人やプログラミング言語愛好家のためのアルファ版と位置づけている。
  • モジラの理念を守り[9]、Rust言語は社会に開かれており、開発者たちは利用者からの感想や提言を求めている。
  • Rust 1.0が日本時間の2015年5月16日にリリースされた[10]。
  • 2016年8月2日にリリースされたFirefox 48にはRustで書き直されたメディアパーサが組み込まれており、Mozillaが開発しているブラウザのFirefoxにおいてRustで書かれたコードが書き加えられる初例となった[11][12]。
  • 2016年9月にRustはFedora 24の標準コンポーネントに加えられ、RPMのパッケージ管理システムを用いてのインストール作業が容易化されている[13]。

特徴

  • ネットワークを相手に動作する比較的大きな、サーバやクライアントプログラムを作成するのに都合が良い言語を目指したものである。結果として、安全性、メモリ管理、並列性が、この言語の目立った特徴となっている。性能はC++言語に匹敵するものになるはずである[14]。
  • バージョン1.12より導入されたMIR (Mid-level IR)[15] によって、コンパイルと実行時間の迅速化ならびに型チェックの正確性の実現が図られている。ブロックに中括弧を使うなど、構文はC言語風である。
  • 制御構造には if, else, do, while, for などがある。以上のようにC言語風であるが、C言語のキーワードが全てあるわけではなく、一方で多方向分岐の match 文など、あまり馴染みがないキーワードもある[16]。
  • 構文は似ているが、意味論(セマンティクス)では大きく異なる部分がある。 このシステムの設計はメモリー・セーフであり、ヌルポインタや不正なメモリ域を指すポインターは許容されていない。データの値は決まったフォームのみで初期化され、それらの全ての入力は既に初期化されている必要がある[17]。
  • この言語の型システムではHaskell言語に倣い「型クラス」を用いることができる。これはアドホックな多相性を容易にするものであり、可変型宣言により実現されるものである。高類多相性[18]など、Haskell言語にある他の特徴はサポートされていない。
  • Rust言語では予約語「let」で宣言された変数に対して型推論が行われる。これらの変数は型を決定するための値を必要としない。コード中のどこかでそれらの変数への値の代入[19]が失敗した場合にはコンパイル時エラーが発生する[20]。型が明示された関数の引数に対しては型推論は行われない。
  • fn fib(n: u32) -> u32 { }
  • なおこれを以下のように、型を省いて記述することはできない。
  • fn fib(n) -> { }

並列性の機構は軽量タスクとして提供される。これと類似の仕組みはErlang言語などのアクターモデルの言語にも見られるものである。それらのシステムにおいて、複数のタスク同士は直接にデータを共有するのではなく、メッセージ・パッシングによってデータのやり取りを行う。性能上の理由から、データのやり取りには固有の箱[21]を使って行われ、データの複製はされない。それらの箱は所有者が一人であることが保証されたもので、送信タスクから受信タスクに向けて開放することができる。

Rust言語が備えるオブジェクトシステムは、impl(実装)、trait(トレイト)、struct(構造体)を基本として構成される。implが他の言語におけるクラスに近い役割を果たし、継承と多相性はトレイトによって提供される。トレイトにはメソッドを定義することができ、実装によってミックスインされる。structにはフィールドが定義可能で、traitとimplはそれ自身にはフィールドは定義できない。菱形継承問題が回避するためにtraitのみが継承が可能である。

プログラム例

以下のコードはRust 1.0.0 Alphaにおいて正しいプログラムである。文法や意味論は後の版で改変される可能性がある。

Hello World


fn main() { println!("hello, world"); }

階乗

階乗を求めるプログラム。再帰呼び出しによるものと、繰り返し処理によるもの。


/* return 文なしに暗黙に値を返すRust言語の機能を示す例である。 関数型様式のプログラムを作成する際に、この特徴は便利である。 C言語やC++言語とは異なり、Rust言語の if は文ではなく式である。 そのため、返し値を伴わなければならない。 */ fn fac_recursive(n: u32) -> u32 { if n <= 1 { 1 } else { n * fac_recursive(n-1) } } fn fac_iterative(n: u32) -> u32 { // 変数は予約語 mut で宣言することで可変になる。 let mut result = 1; for i in 2..n+1 { result *= i; } return result; // 明示的な return 文。関数型の例と対照的。 } fn fac_iterator(n: u32) -> u32 { (1..n + 1).fold(1, |acc, x| acc * x) }

言語の発展

この言語の開発の初期の頃、変数名や関数名など識別子としてASCII文字以外の文字を使うことは禁じられていた。言語についてのある質疑応答の中で、現場の非英語圏のプログラマーのほとんどが識別子にはASCII文字を使っていると述べられていた。しかしその制限は反論を引き出すことになった[22]。それで、2011年2月に言語に変更が行われ、この制限は削除された[23]。








驚くばかり の RUST

Awesome Rust

A curated list of Rust code and resources, inspired by other awesome lists.

If you want to contribute, please read this.

Table of Contents

Applications written in Rust

See also Friends of Rust (organizations running Rust in production).

Development tools

Build system

Debugging

  • GDB
  • LLDB
  • rr
    • rr — rr is a lightweight tool for recording and replaying execution of applications

Embedded

Rust Embedded

  • Cross compiling
    • japaric/rust-cross — everything you need to know about cross compiling Rust programs
    • japaric/xargo — effortless cross compilation of Rust programs to custom bare-metal targets like ARM Cortex-M
  • Raspberry Pi

FFI

See also Foreign Function Interface, The Rust FFI Omnibus (a collection of examples of using code written in Rust from other languages) and FFI examples written in Rust.

IDEs

See also http://areweideyet.com/ and Rust and IDEs.

Pattern Recognition

  • sfikas/rusteval — A tool used to evaluate the output of retrieval algorithms Build Status

Profiling

Testing

[testing]

Libraries

Astronomy

[astronomy]

Asynchronous

  • zonyitoo/coio-rs — a coroutine I/O library with a working-stealing scheduler
  • dpc/mioco — Scalable, coroutine-based, asynchronous IO handling library Travis CI Build Status
  • alexcrichton/futures-rs — Zero-cost futures in Rust Travis CI Build Status
  • carllerche/mio — MIO is a lightweight IO library for Rust with a focus on adding as little overhead as possible over the OS abstractions

Audio

[audio]

Authentication

Bioinformatics

  • Rust-Bio — bioinformatics libraries in Rust.

Caching

Concurrency

Cloud

Command-line argument parsing

Command-line interface

Compression

Computation

Configuration

  • mehcode/config-rs [config] — Layered configuration system for Rust applications (with strong support for 12-factor applications).

Cryptography

[crypto, cryptography]

Database

[database]

Data structures

Date and time

[date, time]

Distributed Systems

Email

[email]

Encoding

[encoding]

Filesystem

[filesystem]

Game development

Geospatial

[geo, gis]

  • Georust — geospatial tools and libraries written in Rust

Graphics

[graphics]

Graph processing

GUI

[gui]

Image processing

Logging

[log]

Machine learning

[machine learning]

See also About Rust’s Machine Learning Community.

Markup language

Mobile

Geal/rust_on_mobile

  • Android
  • iOS
    • TimNN/cargo-lipo — a cargo lipo subcommand which automatically creates a universal library for use with your iOS application.
    • vhbit/ObjCrust — using Rust to create an iOS static library
  • Pebble
    • andars/pebble.rs — a crate that allows Rust to be used to develop Pebble applications.

Network programming

Parser

Platform specific

Template engine

Text processing

Text search

Virtualization

Web programming

See also Rust web framework comparison.

Resources

License

CC0

awesome-rust's People

Contributors

adelarsq avatar bonifaido avatar buster avatar dan-t avatar danclive avatar dtolnay avatar flosse avatar frewsxcv avatar iddm avatar ivanceras avatar jaxx avatar kbknapp avatar kud1ing avatar llogiq avatar lucklove avatar nihisil avatar ozkriff avatar phoenixenero avatar pravic avatar readmecritic avatar regexident avatar saurvs avatar simonrw avatar sjmackenzie avatar stebalien avatar taesiri avatar tcfuji avatar timidger avatar wdv4758h avatar whaison 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.