Bria
1
Is there a way I can do this?
#[derive(Debug)]
struct Ax {
n: i32,
m: i32
}
let ax = Ax { n: 1, m: 2 };
println!("{:?}", ax);
// thel last line output: Ax { n: 1, m: 2 }
let ax_fmt = ax.fmt();
assert_eq!(ax_fmt, "Ax { n: 1, m: 2 }"); //the second paramter comes from the output
jw013
2
You can do format!("{:?}", ax)
which returns a String
.
3 Likes
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.