mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
15 lines
328 B
Rust
15 lines
328 B
Rust
// run-pass
|
|
|
|
use std::fmt;
|
|
|
|
struct Array<T>(T);
|
|
|
|
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<[T; N]> {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
f.debug_list().entries((&self.0 as &[T]).iter()).finish()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(format!("{:?}", Array([1, 2, 3])), "[1, 2, 3]");
|
|
}
|