メインコンテンツまでスキップ

Rust Cheat Sheet

Array

最大値・最小値

let max = array.iter().max().unwrap();
let min = array.iter().min().unwrap();

str, String

先頭一致

assert!("hello, world!".ends_with("h"));
assert!("hello, world!".ends_with("hello"));

末尾一致

assert!("hello, world!".ends_with("!"));
assert!("hello, world!".ends_with("world!"));