検索
Results of 1 - 10 of about 18 for Display (0.004 sec.)
- ディスプレイ - Rust By Example 日本語版 14086
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...たほうが好ましいでしょう。これは {} を使用する fmt::Display を手動で実装することで可能です。 #![allow(unused)]...se std::fmt; // Define a structure for which `fmt::Display` will be implemented. This is // a tuple struct na...med `Structure` that contains an `i32`. // `fmt::Display`を実装するための構造体を定義します。 // これは`Str...e(i32); // To use the `{}` marker, the trait `fmt::Display` must be implemented // manually for the type. //... - https://man.plustar.jp/rust/example/hello/print/print_display.html - [similar]
- Rust By Example 日本語版 10792
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...ーカーを使用し、デバッギング目的に使われます。 fmt::Display : は {} というマーカーを使用し、より美しく、ユーザ...は、標準ライブラリに含まれているため、ここでは fmt::Display を使用しています。カスタム型をテキストとして表示す...る場合は、さらに手順が必要です。 fmt::Display トレイトを実装すると、自動的に ToString トレイトが...すなわち自動で作成)することができるためです。 fmt::Display の場合はやはり手動で実装しなくてはなりません。 #![... - https://man.plustar.jp/rust/example/print.html - [similar]
- ジェネリック境界 - Rust By Example 日本語版 10500
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...あることがよくあります。例えば、以下の例では、引数の Display トレイトを用いてプリントを行うため、 T が Display...を持っていることを規定しています。つまり、「 T は Display を実装 していなくてはならない 」という意味です。 /...a generic type `T` which // must implement trait `Display`. // `Display`トレイトを実装している`T`を引数として...取る // `printer`という関数を定義。 fn printer<T: Display>(t: T) { println!("{}", t); } 境界は、ジェネリクス... - https://man.plustar.jp/rust/example/generics/bounds.html - [similar]
- フォーマット - Rust By Example 日本語版 9179
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...トを用いて実装されています。 最も一般的なトレイトは Display で、これは引数タイプが未指定(たとえば {} )の時に...呼び出されます。 use std::fmt::{self, Formatter, Display}; struct City { name: &'static str, // Latitude //...緯度 lat: f32, // Longitude // 経度 lon: f32, } impl Display for City { // `f` is a buffer, and this method mus...{} once you've added an implementation // for fmt::Display. // fmt::Displayに実装を追加したら、 {} を使用する... - https://man.plustar.jp/rust/example/hello/print/fmt.html - [similar]
- create - Rust By Example 日本語版 9042
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...n() { let path = Path::new("lorem_ipsum.txt"); let display = path.display(); // Open a file in write-only mod...th) { Err(why) => panic!("couldn't create {}: {}", display, why), Ok(file) => file, }; // Write the `LOREM_IP...) { Err(why) => panic!("couldn't write to {}: {}", display, why), Ok(_) => println!("successfully wrote to {}...", display), } } 以下は成功時に期待されるアウトプットです。 $... - https://man.plustar.jp/rust/example/std_misc/file/create.html - [similar]
- Path - Rust By Example 日本語版 9042
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...から`Path`を作成 let path = Path::new("."); // The `display` method returns a `Display`able structure // `disp...lay`メソッドは`Display`可能な構造体を返す。 let _display = path.display()... - https://man.plustar.jp/rust/example/std_misc/path.html - [similar]
- open - Rust By Example 日本語版 8664
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...Path`を作成 let path = Path::new("hello.txt"); let display = path.display(); // Open the path in read-only mo...を返す。 Err(why) => panic!("couldn't open {}: {}", display, why), Ok(file) => file, }; // Read the file conte...ut s) { Err(why) => panic!("couldn't read {}: {}", display, why), Ok(_) => print!("{} contains:\n{}", display... - https://man.plustar.jp/rust/example/std_misc/file/open.html - [similar]
- デバッグ - Rust By Example 日本語版 8167
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...すなわち自動で作成)することができるためです。 fmt::Display の場合はやはり手動で実装しなくてはなりません。 #![...This structure cannot be printed either with `fmt::Display` or // with `fmt::Debug`. // この構造体は`fmt::Dis...etty print println!("{:#?}", peter); } 手動で fmt::Display を実装することでプリント結果を思い通りにできます。... - https://man.plustar.jp/rust/example/hello/print/print_debug.html - [similar]
- 複数のジェネリック境界 - Rust By Example 日本語版 8012
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...常時と同様、 , で区切ります。 use std::fmt::{Debug, Display}; fn compare_prints<T: Debug + Display>(t: &T) { p...rintln!("Debug: `{:?}`", t); println!("Display: `{}`", t); } fn compare_types<T: Debug, U: Debug>... - https://man.plustar.jp/rust/example/generics/multi_bounds.html - [similar]
- テストケース: リスト - Rust By Example 日本語版 7858
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...ース: リスト 構造体のそれぞれの要素を別々に扱う fmt::Display を実装するのはトリッキーです。というのも、それぞれ...f, "{}", value)); ? を使用できれば、 Vec 用の fmt::Display はより簡単に実装できます。 use std::fmt; // Import...う名の構造体を定義 struct List(Vec<i32>); impl fmt::Display for List { fn fmt(&self, f: &mut fmt::Formatter) -... - https://man.plustar.jp/rust/example/hello/print/print_display/testcase_list.html - [similar]