Skip to content

Commit

Permalink
Merge pull request #1878 from multiversx/deprecate-sort
Browse files Browse the repository at this point in the history
deprecating sort due to alloc
  • Loading branch information
alyn509 authored Nov 27, 2024
2 parents 3efbbe3 + 595b829 commit b41361a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions framework/base/src/types/managed/wrapped/managed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,20 @@ where
M: ManagedTypeApi,
T: ManagedVecItem + Ord + Debug,
{
#[deprecated(since = "0.54.5", note = "Please use method `sort_unstable` instead.")]
#[cfg(feature = "alloc")]
pub fn sort(&mut self) {
self.with_self_as_slice_mut(|slice| {
slice.sort();
slice
});
}

#[deprecated(
since = "0.54.5",
note = "Please use method `sort_unstable_by` instead."
)]
#[cfg(feature = "alloc")]
pub fn sort_by<F>(&mut self, mut compare: F)
where
F: FnMut(&T, &T) -> Ordering,
Expand All @@ -373,6 +380,11 @@ where
});
}

#[deprecated(
since = "0.54.5",
note = "Please use method `sort_unstable_by_key` instead."
)]
#[cfg(feature = "alloc")]
pub fn sort_by_key<K, F>(&mut self, mut f: F)
where
F: FnMut(&T) -> K,
Expand All @@ -384,6 +396,8 @@ where
});
}

#[deprecated]
#[cfg(feature = "alloc")]
pub fn sort_by_cached_key<K, F>(&mut self, mut f: F)
where
F: FnMut(&T) -> K,
Expand Down

0 comments on commit b41361a

Please sign in to comment.