해결된 질문
작성
·
105
0
struct Color(i32, i32, i32);
struct Point(i32, i32, i32);
fn main() {
let c = Color(255, 0, 0); // RGB 값 (빨간색)
let p = Point(0, 0, 0); // 3D 공간의 원점
println!("Color is {:?}", c);
println!("Point is {:?}", p);
}
Color
doesn't implement Debug
the trait Debug
is not implemented for Color
add #[derive(Debug)]
to Color
or manually impl Debug for Color
위와 같은 에러가 발생하는데요 #[dervie(Debug)]
구문을 struct 상단에 기입했을 때 해결이 됩니다.
하지만 어떤 원리로 해결이 된건지는 모르겠습니다.
가르침 부탁드립니다.