Rust numbers
Casting - Rust By Example
From and Into - Rust By Example
Rust type conversion
バイナリを数値にシリアライズする
from_be_bytes
とかがある
u32::from_be_bytes(&slice.try_into().unwrap())
という感じ
スライスのサイズが数値のサイズとあっている必要がある
1byteならu8, 4byteならu32といった感じ
数値をバイト列にするには
to_be_bytes
とかがある