検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 18 for Eq (0.038 sec.)
key型の変種 - Rust By Example 日本語版 12800
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... Coal Navy Ayu Rust By Example 日本語版 key型の変種 Eq と Hash トレイトを実装している型ならば、なんでも H ... ためです。 集合型は、その要素となっている全ての型が Eq を、あるいは Hash を実装している場合、必ず同じトレ ... を実装している場合、 Hash を実装します。 独自の型に Eq あるいは Hash を実装するのは簡単です。以下の一行で ... 済みます。 #[derive(PartialEq, Eq, Hash)] 後はコンパイラがよしなにしてくれます。 ...
https://man.plustar.jp/rust/example/std/hash/alt_key_types.html - [similar]
Unit testing - Rust By Example 日本語版 12233
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... - panics if expression evaluates to false . assert_eq!(left, right) and assert_ne!(left, right) - testin ... g left and right expressions for equality and inequality respectively. pub fn add(a: i ... cope. use super::*; #[test] fn test_add() { assert_eq!(add(1, 2), 3); } #[test] fn test_bad_add() { // T ... , that private functions can be tested too! assert_eq!(bad_add(1, 2), 3); } } Tests can be run with carg ...
https://man.plustar.jp/rust/example/testing/unit_testing.html - [similar]
impl Trait - Rust By Example 日本語版 11238
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ![4, 5]; let mut v3 = combine_vecs(v1, v2); assert_eq!(Some(1), v3.next()); assert_eq!(Some(2), v3.next( ... )); assert_eq!(Some(3), v3.next()); assert_eq!(Some(4), v3.next( ... )); assert_eq!(Some(5), v3.next()); println!("all done"); } More ... () { let plus_one = make_adder_function(1); assert_eq!(plus_one(2), 3); } You can also use impl Trait to ...
https://man.plustar.jp/rust/example/trait/impl_trait.html - [similar]
TryFromおよびTryInto - Rust By Example 日本語版 9677
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... use std::convert::TryInto; #[derive(Debug, PartialEq)] struct EvenNumber(i32); impl TryFrom<i32> for Ev ... else { Err(()) } } } fn main() { // TryFrom assert_eq!(EvenNumber::try_from(8), Ok(EvenNumber(8))); asse ... rt_eq!(EvenNumber::try_from(5), Err(())); // TryInto let ... : Result<EvenNumber, ()> = 8i32.try_into(); assert_eq!(result, Ok(EvenNumber(8))); let result: Result<Ev ...
https://man.plustar.jp/rust/example/conversion/try_from_try_into.html - [similar]
Dev-dependencies - Rust By Example 日本語版 8973
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... pretty_assertions , which extends standard assert_eq! and assert_ne! macros, to provide colorful diff. ... ests { use super::*; use pretty_assertions::assert_eq; // crate for test-only use. Cannot be used in non ... -test code. #[test] fn test_add() { assert_eq!(add(2, 3), 5); } } See Also Cargo docs on specify ...
https://man.plustar.jp/rust/example/testing/dev_dependencies.html - [similar]
テストケース: 空トレイト - Rust By Example 日本語版 8115
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ることには変わりはない」という帰結がもたらされます。 Eq と Copy は std ライブラリにおけるそのような例です。 ... の行をアンコメントしてみましょう。 } 参照 std::cmp::Eq , [ std::cmp::Ord s][ord], トレイト 関連キーワード ...
https://man.plustar.jp/rust/example/generics/bounds/testcase_empty.html - [similar]
Integration testing - Rust By Example 日本語版 8115
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... extern crate adder; #[test] fn test_add() { assert_eq!(adder::add(3, 2), 5); } Running tests with cargo ... ub fn setup() { // some setup code, like creating required files/directories, starting // servers, etc. ... () { // using common code. common::setup(); assert_eq!(adder::add(3, 2), 5); } Modules with common code ...
https://man.plustar.jp/rust/example/testing/integration_testing.html - [similar]
Disambiguating overlapping traits - Rust By Example 日本語版 8115
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... nt many different traits. What if two traits both require the same name? For example, many traits might ... ame = <Form as UsernameWidget>::get(&form); assert_eq!("rustacean".to_owned(), username); let age = <For ... m as AgeWidget>::get(&form); assert_eq!(28, age); } 参照 The Rust Programming Language ch ...
https://man.plustar.jp/rust/example/trait/disambiguating.html - [similar]
Iterator::find - Rust By Example 日本語版 7978
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... mber = vec.iter().position(|x| x % 2 == 0); assert_eq!(index_of_first_even_number, Some(5)); let index_o ... e_number = vec.iter().position(|x| x < &0); assert_eq!(index_of_first_negative_number, None); } 参照 std ...
https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_find.html - [similar]
Documentation testing - Rust By Example 日本語版 7978
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... // let result = doccomments::add(2, 3); /// assert_eq!(result, 5); /// ``` pub fn add(a: i32, b: i32) -> ... / let result = doccomments::div(10, 2); /// assert_eq!(result, 5); /// ``` /// /// # Panics /// /// The ...
https://man.plustar.jp/rust/example/testing/doc_testing.html - [similar]
PREV 1 2 NEXT