Perl日記

日々の知ったことのメモなどです。Perlは最近やってないです。

2022-05-15から1日間の記事一覧

Rust で println!("{}", x) で参照が自動的にデリファレンスされるやつと std::fmt::Display のやつのメモ

std::fmt::Display のやつ println!("{:?}", x) で表示させるには derive(Debug) をしておけばよいが、println!("{}", x) では std::fmt::Display トレイトを実装している必要があるようだ。 #[derive(Debug)] struct MyStruct(i32); fn main() { let s = My…