I haven't looked at the code, so my two cents may be irrelevant, but it sounds like you could define a structure that borrows the vector, keeps a separate vector of indices into borrowed vector, and has a current element index.
struct SortFacadeIterator<'a, T: Ord> {
data: &'a Vec<T>,
indices: Vec<usize>,
position: usize,
}
Then in new you would need to sort the original vector but instead of mutating it you would store indices of a resulting sorted elements from the original, i.e. when passed ["b", "a", "c"] you would create index storage of [1, 0, 2]. After that you can iterate both ways, returning an element by index:
impl<'a, T: Ord> SortFacadeIterator<'a, T> {
fn current(&self) -> &T {
self.data[self.indices[self.position]]
}
}
I think, maybe sorting a vector could be done by enumerating original vector and sort_by a value, also I'm not sure you need a full ordering, but I don't remember what a sort expects