asteracea_proc-macro-definitions 0.0.2

Proc macro definitions for Asteracea. They are unlikely to work correctly unless used through the asteracea crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub trait YankAny<T> {
	fn yank_any(&mut self, predicate: impl FnMut(&T) -> bool) -> Option<T>;
}

impl<T> YankAny<T> for Vec<T> {
	fn yank_any(&mut self, mut predicate: impl FnMut(&T) -> bool) -> Option<T> {
		self.iter()
			.enumerate()
			.find(|(_, x)| predicate(x))
			.map(|(i, _)| i)
			.map(|i| self.swap_remove(i))
	}
}