Monthly Archives: December 2015

Generic binary search in Rust

I’ve been using Rust lately, and I really love it.  I wrote a little binary search algorithm that’s generic over the container type, the index type, and the element type, and I thought I’d share it. use std::cmp::Ordering; use std::ops::Add; use std::ops::Div; use std::ops::Index; use std::ops::Sub; pub trait BinarySearch<I, T> {   /// Returns the […]