Rust question 

I tried to implement some generic math types (vectors etc.) And found that the whole bounds thing is pretty terrible.

If I have a function with some 'where' constraints and want to use it, the using Functions also have to fulfill the bounds themselves.

Is there a possibility to combine all those bound in a trait or type etc where I can then just write

Fn X<T> (a: T)
Where T : bounds_type

Instead of having to write

Fn Y<T> (a: T)
Where
T: trait1,
T: trait2,
[...]

?

Follow

Rust question 

I found it.
You write:

trait traitname : trait1 + trait2 [...] {}

And if you have any bound like the std::ops where you have to write your traitname like

<Output = T>

You write:

<Output = Self>

Sign in to participate in the conversation
Gamedev Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!