mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Prefer pop_first if it is available (#3084)
This commit is contained in:
parent
ec4eca4fcb
commit
b55be12d3c
@ -46,12 +46,20 @@ impl TopologicalQueue {
|
||||
}
|
||||
|
||||
/// Take a single entry, preferring parents over children
|
||||
#[rustversion::before(1.66)]
|
||||
fn pop_topmost(&mut self) -> Option<QueueEntry> {
|
||||
// To be replaced with BTreeMap::pop_first once it is stable.
|
||||
// BTreeMap::pop_first is available after 1.66.
|
||||
let key = *self.inner.keys().next()?;
|
||||
self.inner.remove(&key)
|
||||
}
|
||||
|
||||
/// Take a single entry, preferring parents over children
|
||||
#[rustversion::since(1.66)]
|
||||
#[inline]
|
||||
fn pop_topmost(&mut self) -> Option<QueueEntry> {
|
||||
self.inner.pop_first().map(|(_, v)| v)
|
||||
}
|
||||
|
||||
/// Drain all entries, such that children are queued before parents
|
||||
fn drain_post_order_into(&mut self, queue: &mut Vec<QueueEntry>) {
|
||||
if self.inner.is_empty() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user