検索

phrase: max: clip:
target: order:
Results of 1 - 9 of about 9 for contents (0.052 sec.)
テスト駆動開発でライブラリの機能を開発する - Rust 日本語版 13355
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ow(unused)] fn main() { fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { vec![] } #[cfg(test)] ... tは // 安全で速く生産性も高い。 // 3つ選んで。 let contents = "\ Rust: safe, fast, productive. Pick three."; a ... q!( vec!["safe, fast, productive."], search(query, contents) ); } } } リスト12-15: こうだったらいいなという se ... nused)] fn main() { pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { vec![] } } リスト12-16 ...
https://man.plustar.jp/rust/book/ch12-04-testing-the-librarys-functionality.html - [similar]
環境変数を取り扱う - Rust 日本語版 10317
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... 全かつ高速で生産的 // 三つを選んで // ガムテープ let contents = "\ Rust: safe, fast, productive. Pick three. Duc ... q!( vec!["safe, fast, productive."], search(query, contents) ); } #[test] fn case_insensitive() { let query = ... "rUsT"; // (最後の行のみ) // 私を信じて let contents = "\ Rust: safe, fast, productive. Pick three. Tru ... st:", "Trust me."], search_case_insensitive(query, contents) ); } } } リスト12-20: 追加しようとしている大文字小 ...
https://man.plustar.jp/rust/book/ch12-05-working-with-environment-variables.html - [similar]
ファイルを読み込む - Rust 日本語版 9203
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ::open(filename).expect("file not found"); let mut contents = String::new(); f.read_to_string(&mut contents) / ... ; // テキストは\n{}です println!("With text:\n{}", contents); } リスト12-4: 第2引数で指定されたファイルの中身を ... ファイルへの可変なハンドルを得る処理です。二つ目が、 contents という名の変数を生成して、 可変で空の String を割り ... ンドルに対して read_to_string を呼び出し、引数として contents への可変参照を渡す処理です。 それらの行の後に、今回 ...
https://man.plustar.jp/rust/book/ch12-02-reading-a-file.html - [similar]
シングルスレッドのWebサーバを構築する - Rust 日本語版 9113
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... file = File::open("hello.html").unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents ... et response = format!("HTTP/1.1 200 OK\r\n\r\n{}", contents); stream.write(response.as_bytes()).unwrap(); stre ... file = File::open("hello.html").unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents ... et response = format!("HTTP/1.1 200 OK\r\n\r\n{}", contents); stream.write(response.as_bytes()).unwrap(); stre ...
https://man.plustar.jp/rust/book/ch20-01-single-threaded.html - [similar]
入出力プロジェクトを改善する - Rust 日本語版 8250
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ァイル名: src/lib.rs pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { let mut results = Vec: ... :new(); for line in contents.lines() { if line.contains(query) { results.push(l ... ァイル名: src/lib.rs pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { contents.lines() .filt ... ソッドを使用する search 関数の目的は、 query を含む contents の行全てを返すことであることを思い出してください。 ...
https://man.plustar.jp/rust/book/ch13-03-improving-our-io-project.html - [similar]
リファクタリングしてモジュール性とエラー処理を向上させる - Rust 日本語版 8160
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... と filename はプログラムの設定用変数ですが、 f や contents といった変数は、プログラムのロジックを担っています ... config.filename).expect("file not found"); let mut contents = String::new(); f.read_to_string(&mut contents) . ... ong reading the file"); println!("With text:\n{}", contents); } // --snip-- リスト12-11: 残りのプログラムロジッ ... let mut f = File::open(config.filename)?; let mut contents = String::new(); f.read_to_string(&mut contents)?; ...
https://man.plustar.jp/rust/book/ch12-03-improving-error-handling-and-modularity... - [similar]
文字列でUTF-8でエンコードされたテキストを保持する - Rust 日本語版 7693
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... #![allow(unused)] fn main() { let data = "initial contents"; let s = data.to_string(); // the method also wor ... ks on a literal directly: let s = "initial contents".to_string(); } リスト8-12: to_string メソッドを使 ... テラルから String を生成する このコードは、 initial contents (初期値)を含む文字列を生成します。 さらに、 String ... unused)] fn main() { let s = String::from("initial contents"); } リスト8-13: String::from 関数を使って文字列リ ...
https://man.plustar.jp/rust/book/ch08-02-strings.html - [similar]
正常なシャットダウンと片付け - Rust 日本語版 7531
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... mut file = File::open(filename).unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents ... rap(); let response = format!("{}{}", status_line, contents); stream.write(response.as_bytes()).unwrap(); stre ...
https://man.plustar.jp/rust/book/ch20-03-graceful-shutdown-and-cleanup.html - [similar]
パフォーマンス比較:ループVSイテレータ - Rust 日本語版 7208
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ークとするためには、いろんなサイズの様々なテキストを contents として、異なる単語、異なる長さの単語を query として ...
https://man.plustar.jp/rust/book/ch13-04-performance.html - [similar]
PREV 1 NEXT