How to implement T/2.0 T is a Generic


Merry Christmas!

I now writing a binary search program using rust,When calculate the mid((start+end)/2) in c++/c ,I can write like (start+end)/2.0 ,but in rust it’s can I implement it? Thank you for you answer!


Something like

Should also mention that you may want to use an overflow avoiding construction: start + ((end - start) / 2)