検索
Results of 11 - 20 of about 36 for Some (0.073 sec.)
- impl Trait - Rust By Example 日本語版 8907
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
5]; let mut v3 = combine_vecs(v1, v2); assert_eq!(Some(1), v3.next()); assert_eq!(Some(2), v3.next()); as...
sert_eq!(Some(3), v3.next()); assert_eq!(Some(4), v3.next()); as...
sert_eq!(Some(5), v3.next()); println!("all done"); } More impor...
tantly, some Rust types can't be written out. For example, ever...
- https://man.plustar.jp/rust/example/trait/impl_trait.html - [similar]
- 安全でない操作 - Rust By Example 日本語版 8590
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
ssert!(*raw_p == 10); } } Calling Unsafe Functions Some functions can be declared as unsafe , meaning it i...
ment and a length. use std::slice; fn main() { let some_vector = vec![1, 2, 3, 4]; let pointer = some_vect...
or.as_ptr(); let length = some_vector.len(); unsafe { let my_slice: &[u32] = slic...
e::from_raw_parts(pointer, length); assert_eq!(some_vector.as_slice(), my_slice); } } For slice::from_...
- https://man.plustar.jp/rust/example/unsafe.html - [similar]
- ハッシュマップ - Rust By Example 日本語版 8082
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
try again.", "645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you t...
Option<&V>を返す。 match contacts.get(&"Daniel") { Some(&number) => println!("Calling Daniel: {}", call(nu...
` returns `None` // if the inserted value is new, `Some(value)` otherwise // `HashMap::insert()`は // inse...
rtされた値が新しい場合は`None`を // そうでなければ`Some(value)`を返す。 contacts.insert("Daniel", "164-674...
- https://man.plustar.jp/rust/example/std/hash.html - [similar]
- クレート - Rust By Example 日本語版 7655
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
クレートはRustにおけるコンパイルの単位です。 rustc some_file.rs が呼ばれると、 some_file.rs は必ず クレート...
ファイル として扱われます。もし some_file.rs が mod 宣言を含んでいるのならば、コンパイル...
- https://man.plustar.jp/rust/example/crates.html - [similar]
- Returning Traits with dyn - Rust By Example 日本語版 7655
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
irectly, our functions return a Box which contains some Animal . A box is just a reference to some memory...
&self) -> &'static str { "moooooo!" } } // Returns some struct that implements Animal, but we don't know w...
- https://man.plustar.jp/rust/example/trait/dyn.html - [similar]
- Unit testing - Rust By Example 日本語版 7448
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
er. The bodies of test functions typically perform some setup, run the code we want to test, then assert w...
marked with the #[test] attribute. Tests fail when something in the test function panics . There are some...
be marked with the #[ignore] attribute to exclude some tests. Or to run them with command cargo test -- -...
- https://man.plustar.jp/rust/example/testing/unit_testing.html - [similar]
- 条件の追加 - Rust By Example 日本語版 7147
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
フラグを用いて rustc に伝える必要があります。 #[cfg(some_condition)] fn conditional_function() { println!("...
stom cfg flag. cfg フラグがある場合: $ rustc --cfg some_condition custom.rs && ./custom condition met! 関連...
- https://man.plustar.jp/rust/example/attribute/cfg/custom.html - [similar]
- Diverging functions - Rust By Example 日本語版 7147
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
gh there is no information in the return value. fn some_fn() { () } fn main() { let a: () = some_fn(); pri...
- https://man.plustar.jp/rust/example/fn/diverging.html - [similar]
- Where句 - Rust By Example 日本語版 7147
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
ld be using the wrong bound. // プリントされるのが`Some(self)`であるため、この関数の // ジェネリック境界と...
したい。 fn print_in_option(self) { println!("{:?}", Some(self)); } } fn main() { let vec = vec![1, 2, 3]; v...
- https://man.plustar.jp/rust/example/generics/where.html - [similar]
- Integration testing - Rust By Example 日本語版 7147
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
s compiled as a separate crate. One way of sharing some code between integration tests is making a module...
tests. File tests/common.rs : pub fn setup() { // some setup code, like creating required files/directori...
- https://man.plustar.jp/rust/example/testing/integration_testing.html - [similar]