pub struct Triangle<T: Float + std::clone::Clone, V: vector::Vector<T>> {
point1: V,
point2: V,
point3: V,
}
Этот кусок кода не компилируется, потому что T не используется (тем не менее, T используется позже в методе)
Я пробовал этот синтаксис
pub struct Triangle<V: vector::Vector<T: Float + std::clone::Clone>> {
point1: V,
point2: V,
point3: V,
}
Ошибка:
expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `:`
expected one of 7 possible tokens here
и этот синтаксис
pub struct Triangle2<V> where V: vector::Vector<T> where T: Float {
point1: V,
point2: V,
point3: V,
}
Ошибка:
expected `where`, or `{` after struct name, found keyword `where`
expected `where`, or `{` after struct name
, которая не работает.
Является ли ихспособ решить эту проблему