Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

タグ

Rustに関するnobuokaのブックマーク (10)

  • Rust macros in html5ever

    nobuoka
    nobuoka 2016/06/01
    Servo の新しい HTML パーザの html5ever における Rust マクロの話
  • Announcing Rust 1.9 | Rust Blog

    The Rust team is happy to announce the latest version of Rust, 1.9. Rust is a systems programming language focused on safety, speed, and concurrency. As always, you can install Rust 1.9 from the appropriate page on our website, and check out the detailed release notes for 1.9 on GitHub. About 1000 patches were landed in this release. What's in 1.9 stable Controlled unwinding The biggest shift in R

    Announcing Rust 1.9 | Rust Blog
    nobuoka
    nobuoka 2016/05/27
    Rust 1.9〜〜
  • Rustのstd::io::copyとEchoサーバー - Write and Run

    気が向いたので Rust でも書いてみるかという感じになって書いてるんですが、TCP Echo サーバーを書くだけで躓いたのでメモ。 fn main() { use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; use std::thread; let listener = TcpListener::bind("127.0.0.1:8124").unwrap(); fn handle_client(mut stream: TcpStream) { std::io::copy(&mut stream.try_clone().unwrap(), &mut stream); } // accept connections and process them, spawning a new thread for each o

    Rustのstd::io::copyとEchoサーバー - Write and Run
    nobuoka
    nobuoka 2016/05/18
    メソッド呼び出しで引数として同じ変数束縛を何度も渡そうとすると怒られる。 確かに……。 どうするのがいいんだろ。
  • Rustオブジェクトの削除タイミングを手動で制御する - Qiita

    Rust はガベージコレクタを持たない言語だ。コンパイル時に、構造体などのオブジェクトの所有権と生存状態(ライフタイム)を分析することで、オブジェクトを適切なタイミングでメモリから削除する仕組みになっている。この仕組みはとても良くできているが、時々、削除のタイミングを開発者が自分で制御したいこともある。 特にそれが必要になるのが、FFI(他言語関数インターフェイス)経由で、Rust のオブジェクトを他の言語に渡したい時だろう。この場合、他言語にはオブジェクトへのポインタを渡すことになるが、ライフタイムの分析をコンパイラに任せると、Rust の関数を抜けた時にオブジェクトの寿命が尽きたと判断されて、削除されてしまうことがある。これが起こると、他言語に渡したポインタは、参照先のオブジェクトが存在しない状態、いわゆる「ダングリングポインタ」になってしまう。 この記事では簡単な例を使って、ダングリ

    Rustオブジェクトの削除タイミングを手動で制御する - Qiita
    nobuoka
    nobuoka 2016/05/12
    Rust、わかってくるとなるほど感がある
  • https://qiita.com/kondei/items/2ee292d863ea874d7691

    nobuoka
    nobuoka 2016/05/11
    古いバージョンの Rust の話だけどわかりやすい。
  • std::boxed - Rust

    The Box<T> type for heap allocation. Box<T>, casually referred to as a ‘box’, provides the simplest form of heap allocation in Rust. Boxes provide ownership for this allocation, and drop their contents when they go out of scope. Boxes also ensure that they never allocate more than isize::MAX bytes. §Examples Move a value from the stack to the heap by creating a Box:

    nobuoka
    nobuoka 2016/05/11
    Book 読んでたらちょくちょく Box なるものが出てくるけど説明が Book にはなさそう。 『Box<T>, casually referred to as a 'box', provides the simplest form of heap allocation in Rust.』 所有権持っててスコープから外れたら解放してくれるぽい
  • 【Rust】高階関数を作るときのメモ その2 - くどはむと猫の窓

    前回、簡単な高階関数hogeを書きましたが、もう少しだけ分かったことがあるのでまたメモとして残しておきます。 kudohamu.hatenablog.com 今回は高階関数というよりはRustのクロージャについてです。 ※ バーション1.3.0です。Rustは結構頻繁に破壊的な変更が起きるようなので将来ここに書いてある内容は通らない可能性あり。 前回できたもの 前回は以下のように「"ほげー!"という文字列を返す関数」を返す関数hogeを作成しました。 fn main() { println!("{}", hoge()()); } fn hoge() -> Box<Fn() -> String> { Box::new(|| -> String { String::from("ほげー!") }) } ただ、高階関数を作る時は大抵返り値となる関数の中でゴニョゴニョしたいものです。 返り値の関数に

    nobuoka
    nobuoka 2016/05/11
    Rust のクロージャ、所有権とか寿命とかの仕組みと相性悪いような気がするなー
  • なぜRustの人はlifetimeとownershipについて話すのか | Brackets Salad

    これは Rust Language Advent Calendar 2014 の2日目の記事です。前日は @saneyuki_s さんの『Rustプログラミングにおけるデバッグ入門』でした。 今日はlifetimeとownershipの話です。「なんだそれは」と思った方も、「またか」と思った方も、「Rust使ってるからよく知ってるよ」と思った方も少しの間お付き合いください。 はじめに ブラウザの会社が公開したRustというプログラミング言語があります。ブラウザの会社が公開した言語なので、Rustで書かれたブラウザもあります。このプログラミング言語の特徴の一つがlifetimeとownershipです。 例えば、Rustの30分イントロダクションは少し前に書き直されるまではlifetimeとownershipを中心に解説していました。関数型言語に慣れ親しんだ人のために書かれた別のRustイン

    nobuoka
    nobuoka 2016/05/07
  • IronでHTTPサーバーを立てる - Qiita

    RustとHTTP Module std::net というのがありますが、これはプリミティブなTCP/UDP通信を提供するものなので、これをそのまま使ってHTTPを扱うのは少し大変です。 Are we web yet? Getting there を読んで、今回はIronというフレームワークを使ってみました。 バージョンは以下のとおりです。 rust: 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14) iron: 0.1.17 Iron Iron はミドルウェア指向で拡張性の高いHTTPサーバーのフレームワークです。Iron自体のソースコードは小さく、これに必要なミドルウェアやプラグインを足すスタイルになっています。 コアとなるモジュールはあらかじめバンドルされています。 Middleware: Routing Mounting Static

    IronでHTTPサーバーを立てる - Qiita
    nobuoka
    nobuoka 2016/04/04
  • Visual Rust 0.1 is out · Piston

    The Piston team would like to announce release of Visual Rust 0.1 Visual Rust is Visual Studio extension for Rust language. This release adds Rust editor and support for creating, building and running Rust projects. It’s an early version, but we hope you will enjoy using it! Download it from here. Suggest new features and report problems on our issue tracker.

    nobuoka
    nobuoka 2015/05/15
    Rust 開発用の Visual Studio 拡張。
  • 1