Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01734a3

Browse files
qryxipstatiolake
andauthored
Mention that RangeTo<usize> implements SliceIndex<str>
Co-authored-by: statiolake <[email protected]>
1 parent 04bf0dc commit 01734a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/tokiomarine2020-a.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ fn main() {
2525
//
2626
// `ascii`クレートを使わずに行うなら、
2727
//
28-
// 1. Sを`String`として読み、`s.chars().take(3).collect::<String>()`
29-
// 2. Sを[`proconio::marker::Bytes`]経由で`Vec<u8>`として読み(あるいは`String`から`.into_bytes()`する)、`std::str::from_utf8(&s[..3]).unwrap()`
28+
// 1. Sを`String`として読み、`&s[..3]`としてスライスを取得する
29+
// 2. Sを`String`として読み、`s.chars().take(3).collect::<String>()`
30+
// 3. Sを[`proconio::marker::Bytes`]経由で`Vec<u8>`として読み(あるいは`String`から`.into_bytes()`する)、`std::str::from_utf8(&s[..3]).unwrap()`
3031
//
3132
// の2つの方法がある。
3233
//

0 commit comments

Comments
 (0)