検索
Results of 21 - 30 of about 47 for string (0.047 sec.)
- 入出力プロジェクトを改善する - Rust 日本語版 7357
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
ーンすることで、 Config 構造体に値を所有させながら、 String 値のスライスを取り、 Config 構造体のインスタンスを...
イル名: src/lib.rs impl Config { pub fn new(args: &[String]) -> Result<Config, &'static str> { if args.len()...
と述べました。 えっと、その時は今です! 引数 args に String 要素のスライスがあるためにここで clone が必要だった...
して新しくメモリ確保するのではなく、イテレータからの String 値を Config にムーブできます。 返却されるイテレータ...
- https://man.plustar.jp/rust/book/ch13-03-improving-our-io-project.html - [similar]
- シングルスレッドのWebサーバを構築する - Rust 日本語版 7129
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
ead(&mut buffer).unwrap(); println!("Request: {}", String::from_utf8_lossy(&buffer[..])); } リスト20-2: TcpS...
ーのバイトを文字列に変換し、その文字列を出力します。 String::from_utf8_lossy 関数は、 &[u8] を取り、 String を...
e::open("hello.html").unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(...
e::open("hello.html").unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(...
- https://man.plustar.jp/rust/book/ch20-01-single-threaded.html - [similar]
- 高度な関数とクロージャ - Rust 日本語版 7053
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
{ let list_of_numbers = vec![1, 2, 3]; let list_of_strings: Vec<String> = list_of_numbers .iter() .map(|i| i...
.to_string()) .collect(); } あるいは、このようにクロージャの代...
{ let list_of_numbers = vec![1, 2, 3]; let list_of_strings: Vec<String> = list_of_numbers .iter() .map(ToStr...
ing::to_string) .collect(); } 先ほど「高度なトレイト」節で語ったフ...
- https://man.plustar.jp/rust/book/ch19-05-advanced-functions-and-closures.html - [similar]
- テストの記述法 - Rust 日本語版 6946
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
ァイル名: src/lib.rs pub fn greeting(name: &str) -> String { format!("Hello {}!", name) } #[cfg(test)] mod te...
るのか確かめましょう: pub fn greeting(name: &str) -> String { String::from("Hello!") } #[cfg(test)] mod tests...
を与えてみましょう。 pub fn greeting(name: &str) -> String { String::from("Hello!") } #[cfg(test)] mod tests...
a backtrace. note: panic did not contain expected string panic message: `"Guess value must be greater than...
- https://man.plustar.jp/rust/book/ch11-01-writing-tests.html - [similar]
- ファイルを読み込む - Rust 日本語版 6946
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
use std::io::prelude::*; fn main() { let args: Vec<String> = env::args().collect(); let query = &args[1]; le...
name).expect("file not found"); let mut contents = String::new(); f.read_to_string(&mut contents) // ファイル...
が、 contents という名の変数を生成して、 可変で空の String を割り当てる処理です。この変数が、ファイル読み込み...
します。 三つ目が、ファイルハンドルに対して read_to_string を呼び出し、引数として contents への可変参照を渡す...
- https://man.plustar.jp/rust/book/ch12-02-reading-a-file.html - [similar]
- Dropトレイトで片付け時にコードを走らせる - Rust 日本語版 6946
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
ル名: src/main.rs struct CustomSmartPointer { data: String, } impl Drop for CustomSmartPointer { fn drop(&mut...
} } fn main() { let c = CustomSmartPointer { data: String::from("my stuff") }; // 俺のもの let d = CustomSma...
rtPointer { data: String::from("other stuff") }; // 別のもの println!("Cust...
.rs fn main() { let c = CustomSmartPointer { data: String::from("some data") }; println!("CustomSmartPointer...
- https://man.plustar.jp/rust/book/ch15-03-drop.html - [similar]
- パターン記法 - Rust 日本語版 6886
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
num Message { Quit, Move { x: i32, y: i32 }, Write(String), ChangeColor(i32, i32, i32), } fn main() { let ms...
ラーを提示するでしょう。 // こんにちは! let s = Some(String::from("Hello!")); if let Some(_s) = s { // 文字列が...
見つかりました println!("found a string"); } println!("{:?}", s); リスト18-21: それでも、ア...
きます。 #![allow(unused)] fn main() { let s = Some(String::from("Hello!")); if let Some(_) = s { println!("f...
- https://man.plustar.jp/rust/book/ch18-03-pattern-syntax.html - [similar]
- モジュールツリーの要素を示すためのパス - Rust 日本語版 6810
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
back_of_house { pub struct Breakfast { pub toast: String, seasonal_fruit: String, } impl Breakfast { pub fn...
mer(toast: &str) -> Breakfast { Breakfast { toast: String::from(toast), seasonal_fruit: String::from("peache...
d we'd like // やっぱり別のパンにする meal.toast = String::from("Wheat"); println!("I'd like {} toast please...
ることも許されていないので // meal.seasonal_fruit = String::from("blueberries"); } } Listing 7-9: 公開のフィー...
- https://man.plustar.jp/rust/book/ch07-03-paths-for-referring-to-an-item-in-the-m... - [similar]
- クロージャ:環境をキャプチャできる匿名関数 - Rust 日本語版 6810
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
加えていないことに注意してください: それから1回目に String を引数に、 2回目に u32 を引数に使用してこのクロージ...
t example_closure = |x| x; let s = example_closure(String::from("hello")); let n = example_closure(5); リスト...
n = example_closure(5); | ^ expected struct `std::string::String`, found integral variable | = note: expect...
ed type `std::string::String` found type `{integer}` String 値で exampl...
- https://man.plustar.jp/rust/book/ch13-01-closures.html - [similar]
- 一連の要素をイテレータで処理する - Rust 日本語版 6764
- The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello,
...
PartialEq, Debug)] struct Shoe { size: u32, style: String, } fn shoes_in_my_size(shoes: Vec<Shoe>, shoe_size...
size() { let shoes = vec![ Shoe { size: 10, style: String::from("sneaker") }, Shoe { size: 13, style: String...
::from("sandal") }, Shoe { size: 10, style: String::from("boot") }, ]; let in_my_size = shoes_in_my_s...
ert_eq!( in_my_size, vec![ Shoe { size: 10, style: String::from("sneaker") }, Shoe { size: 10, style: String...
- https://man.plustar.jp/rust/book/ch13-02-iterators.html - [similar]