Given a LineSegment and fn contour1 and fn contour2.
How do I make a fn contour that takes both &[LineSegment] and &[(Vec3, Vec3)] ?
struct Vec3 {
x: f32,
y: f32,
z: f32,
}
struct LineSegment(Vec3, Vec3);
// take a slice of LineSegment
fn contour1(lines: &[LineSegment]) {
for LineSegment(a, b) in lines {
do_something(*a, *b);
}
}
// take a slice of (Vec3, Vec3)
fn contour2(lines: &[(Vec3, Vec3)]) {
for (a, b) in lines {
do_something(*a, *b);
}
}
fn contour<T: ?>(lines: T) {
for (a, b) in lines {
do_something(*a, *b);
}
}