2019-05-11 12:58:15 -05:00
|
|
|
// run-pass
|
|
|
|
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
struct Array<T, const N: usize>([T; N]);
|
|
|
|
|
2019-11-18 13:57:23 -06:00
|
|
|
impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, N> {
|
2019-05-11 12:58:15 -05:00
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
f.debug_list().entries(self.0.iter()).finish()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-05-28 15:34:18 -05:00
|
|
|
assert_eq!(format!("{:?}", Array([1, 2, 3])), "[1, 2, 3]");
|
2019-05-11 12:58:15 -05:00
|
|
|
}
|