検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 30 for impl (0.027 sec.)
トレイト:共通の振る舞いを定義する - Rust 日本語版 13792
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... String, pub author: String, pub content: String, } impl Summary for NewsArticle { fn summarize(&self) -> S ... ent: String, pub reply: bool, pub retweet: bool, } impl Summary for Tweet { fn summarize(&self) -> String ... 、普通のメソッドを実装することに似ています。違いは、 impl の後に、 実装したいトレイトの名前を置き、それから ... らにトレイトの実装対象の型の名前を指定することです。 impl ブロック内に、トレイト定義で定義したメソッドシグニ ...
https://man.plustar.jp/rust/book/ch10-02-traits.html - [similar]
メソッド記法 - Rust 日本語版 12038
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn area(&self) -> u32 { self.width * s ... を定義する Rectangle の文脈内で関数を定義するには、 impl (implementation; 実装)ブロックを始めます。 それから ... area 関数を impl の波かっこ内に移動させ、最初の(今回は唯一の)引数を ... ています。 というのも、コンパイラは、このメソッドが impl Rectangle という文脈内に存在するために、 self の型 ...
https://man.plustar.jp/rust/book/ch05-03-method-syntax.html - [similar]
高度なトレイト - Rust 日本語版 11209
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... 型は u32 だと指定しました: ファイル名: src/lib.rs impl Iterator for Counter { type Item = u32; fn next(&m ... 、 Item の型は1回しか選択できませんでした。 1つしか impl Iterator for Counter がないからです。 Counter に n ... ebug, PartialEq)] struct Point { x: i32, y: i32, } impl Add for Point { type Output = Point; fn add(self, ... :Add; struct Millimeters(u32); struct Meters(u32); impl Add<Meters> for Millimeters { type Output = Millim ...
https://man.plustar.jp/rust/book/ch19-03-advanced-traits.html - [similar]
オブジェクト指向デザインパターンを実装する - Rust 日本語版 9828
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... st { state: Option<Box<State>>, content: String, } impl Post { pub fn new() -> Post { Post { state: Some(B ... tring::new(), } } } trait State {} struct Draft {} impl State for Draft {} } リスト17-12: Post 構造体、新規 ... xt メソッドは非常に素直なので、リスト17-13の実装を impl Post ブロックに追加しましょう: ファイル名: src/lib ... ] fn main() { pub struct Post { content: String, } impl Post { // --snip-- pub fn add_text(&mut self, text ...
https://man.plustar.jp/rust/book/ch17-03-oo-design-patterns.html - [similar]
シングルスレッドサーバをマルチスレッド化する - Rust 日本語版 9292
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... tener; use std::net::TcpStream; struct ThreadPool; impl ThreadPool { fn new(size: u32) -> ThreadPool { Thr ... [allow(unused)] fn main() { pub struct ThreadPool; impl ThreadPool { pub fn new(size: usize) -> ThreadPool ... [allow(unused)] fn main() { pub struct ThreadPool; impl ThreadPool { // --snip-- pub fn execute<F>(&self, ... [allow(unused)] fn main() { pub struct ThreadPool; impl ThreadPool { /// 新しいThreadPoolを生成する。 /// ...
https://man.plustar.jp/rust/book/ch20-02-multithreaded.html - [similar]
正常なシャットダウンと片付け - Rust 日本語版 8837
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ドはまだ完全には動きません。 ファイル名: src/lib.rs impl Drop for ThreadPool { fn drop(&mut self) { for wor ... 以下の変更を行なってください: ファイル名: src/lib.rs impl Worker { fn new(id: usize, receiver: Arc<Mutex<mps ... 。以下の変更がそれを行います: ファイル名: src/lib.rs impl Drop for ThreadPool { fn drop(&mut self) { for wor ... ker>, sender: mpsc::Sender<Message>, } // --snip-- impl ThreadPool { // --snip-- pub fn execute<F>(&self, ...
https://man.plustar.jp/rust/book/ch20-03-graceful-shutdown-and-cleanup.html - [similar]
ジェネリックなデータ型 - Rust 日本語版 8610
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... if item > largest { | ^^^^^^^^^^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missi ... イル名: src/main.rs struct Point<T> { x: T, y: T, } impl<T> Point<T> { fn x(&self) -> &T { &self.x } } fn m ... を返す x というメソッドを Point<T> に定義しました。 impl の直後に T を宣言しなければならないことに注意してく ... ことを指定するために、 T を使用することができます。 impl の後に T をジェネリックな型として宣言することで、コ ...
https://man.plustar.jp/rust/book/ch10-01-syntax.html - [similar]
マクロ - Rust 日本語版 8464
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ょう。 use hello_macro::HelloMacro; struct Pancakes; impl HelloMacro for Pancakes { fn hello_macro() { print ... ファイルにリスト19-31のコードを配置してください。 impl_hello_macro 関数の定義を追加するまでこのコードはコ ... (); // トレイトの実装内容を構築 // Build the trait implementation impl_hello_macro(&ast) } リスト19-31: Ru ... lo_macro_derive 関数と、構文木を変換する役割を持つ impl_hello_macro 関数にコードを分割したことに注目してく ...
https://man.plustar.jp/rust/book/ch19-06-macros.html - [similar]
Derefトレイトでスマートポインタを普通の参照のように扱う - Rust 日本語版 8074
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... the trait `std::cmp::PartialEq<&{integer}>` is not implemented for `{integer}` (助言: トレイト`std::cmp::P ... #![allow(unused)] fn main() { struct MyBox<T>(T); impl<T> MyBox<T> { fn new(x: T) -> MyBox<T> { MyBox(x) ... main() { use std::ops::Deref; struct MyBox<T>(T); impl<T> Deref for MyBox<T> { type Target = T; fn deref( ... c/main.rs use std::ops::Deref; struct MyBox<T>(T); impl<T> MyBox<T> { fn new(x: T) -> MyBox<T> { MyBox(x) ...
https://man.plustar.jp/rust/book/ch15-02-deref.html - [similar]
テストの記述法 - Rust 日本語版 7993
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn can_hold(&self, other: &Rectangle) ... ug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn can_hold(&self, other: &Rectangle) ... ug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn can_hold(&self, other: &Rectangle) ... Rectangle { width: u32, height: u32, } // --snip-- impl Rectangle { fn can_hold(&self, other: &Rectangle) ...
https://man.plustar.jp/rust/book/ch11-01-writing-tests.html - [similar]
PREV 1 2 3 NEXT