From 4f1cca8501cb0486c318a9b918e141ab56d47078 Mon Sep 17 00:00:00 2001 From: cosineblast <55855728+cosineblast@users.noreply.github.com> Date: Wed, 26 Mar 2025 07:10:05 -0300 Subject: [PATCH] Rename jobs::Tag to jobs::FilterTag --- crates/nu-command/src/experimental/job_recv.rs | 4 ++-- crates/nu-command/src/experimental/job_send.rs | 4 ++-- crates/nu-protocol/src/engine/jobs.rs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/nu-command/src/experimental/job_recv.rs b/crates/nu-command/src/experimental/job_recv.rs index 3a3d120859..1ed6cf44c2 100644 --- a/crates/nu-command/src/experimental/job_recv.rs +++ b/crates/nu-command/src/experimental/job_recv.rs @@ -1,7 +1,7 @@ use std::{sync::mpsc::RecvTimeoutError, time::Duration}; use nu_engine::command_prelude::*; -use nu_protocol::engine::Tag; +use nu_protocol::engine::FilterTag; #[derive(Clone)] pub struct JobRecv; @@ -68,7 +68,7 @@ in no particular order, regardless of the specified timeout parameter. } } - let tag = tag_arg.map(|it| it.item as Tag); + let tag = tag_arg.map(|it| it.item as FilterTag); let duration: Option = call.get_flag(engine_state, stack, "timeout")?; diff --git a/crates/nu-command/src/experimental/job_send.rs b/crates/nu-command/src/experimental/job_send.rs index 212a13d070..0b865fbd23 100644 --- a/crates/nu-command/src/experimental/job_send.rs +++ b/crates/nu-command/src/experimental/job_send.rs @@ -1,5 +1,5 @@ use nu_engine::command_prelude::*; -use nu_protocol::{engine::Tag, JobId}; +use nu_protocol::{engine::FilterTag, JobId}; #[derive(Clone)] pub struct JobSend; @@ -67,7 +67,7 @@ This command never blocks. } } - let tag = tag_arg.map(|it| it.item as Tag); + let tag = tag_arg.map(|it| it.item as FilterTag); let value = input.into_value(head)?; diff --git a/crates/nu-protocol/src/engine/jobs.rs b/crates/nu-protocol/src/engine/jobs.rs index 6105e9237f..7fd301b753 100644 --- a/crates/nu-protocol/src/engine/jobs.rs +++ b/crates/nu-protocol/src/engine/jobs.rs @@ -261,7 +261,7 @@ impl Mailbox { #[cfg(not(target_family = "wasm"))] pub fn recv_timeout( &mut self, - filter_tag: Option, + filter_tag: Option, timeout: Duration, ) -> Result { if let Some(value) = self.ignored_mail.pop(filter_tag) { @@ -300,11 +300,11 @@ impl Mailbox { struct IgnoredMail { next_id: usize, messages: BTreeMap, - by_tag: HashMap>, + by_tag: HashMap>, } -pub type Tag = u64; -pub type Mail = (Option, Value); +pub type FilterTag = u64; +pub type Mail = (Option, Value); impl IgnoredMail { pub fn add(&mut self, (tag, value): Mail) { @@ -318,7 +318,7 @@ impl IgnoredMail { } } - pub fn pop(&mut self, tag: Option) -> Option { + pub fn pop(&mut self, tag: Option) -> Option { if let Some(tag) = tag { self.pop_oldest_with_tag(tag) } else { @@ -350,7 +350,7 @@ impl IgnoredMail { Some(value) } - fn pop_oldest_with_tag(&mut self, tag: Tag) -> Option { + fn pop_oldest_with_tag(&mut self, tag: FilterTag) -> Option { let ids = self.by_tag.get_mut(&tag)?; let id = ids.pop_first()?;