Rename jobs::Tag to jobs::FilterTag

This commit is contained in:
cosineblast 2025-03-26 07:10:05 -03:00
parent 4c716cef75
commit 4f1cca8501
3 changed files with 10 additions and 10 deletions

View File

@ -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<i64> = call.get_flag(engine_state, stack, "timeout")?;

View File

@ -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)?;

View File

@ -261,7 +261,7 @@ impl Mailbox {
#[cfg(not(target_family = "wasm"))]
pub fn recv_timeout(
&mut self,
filter_tag: Option<Tag>,
filter_tag: Option<FilterTag>,
timeout: Duration,
) -> Result<Value, RecvTimeoutError> {
if let Some(value) = self.ignored_mail.pop(filter_tag) {
@ -300,11 +300,11 @@ impl Mailbox {
struct IgnoredMail {
next_id: usize,
messages: BTreeMap<usize, Mail>,
by_tag: HashMap<Tag, BTreeSet<usize>>,
by_tag: HashMap<FilterTag, BTreeSet<usize>>,
}
pub type Tag = u64;
pub type Mail = (Option<Tag>, Value);
pub type FilterTag = u64;
pub type Mail = (Option<FilterTag>, Value);
impl IgnoredMail {
pub fn add(&mut self, (tag, value): Mail) {
@ -318,7 +318,7 @@ impl IgnoredMail {
}
}
pub fn pop(&mut self, tag: Option<Tag>) -> Option<Value> {
pub fn pop(&mut self, tag: Option<FilterTag>) -> Option<Value> {
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<Value> {
fn pop_oldest_with_tag(&mut self, tag: FilterTag) -> Option<Value> {
let ids = self.by_tag.get_mut(&tag)?;
let id = ids.pop_first()?;