mirror of
https://github.com/nushell/nushell.git
synced 2025-06-20 09:58:15 +02:00
Rename jobs::Tag to jobs::FilterTag
This commit is contained in:
parent
4c716cef75
commit
4f1cca8501
@ -1,7 +1,7 @@
|
|||||||
use std::{sync::mpsc::RecvTimeoutError, time::Duration};
|
use std::{sync::mpsc::RecvTimeoutError, time::Duration};
|
||||||
|
|
||||||
use nu_engine::command_prelude::*;
|
use nu_engine::command_prelude::*;
|
||||||
use nu_protocol::engine::Tag;
|
use nu_protocol::engine::FilterTag;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct JobRecv;
|
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")?;
|
let duration: Option<i64> = call.get_flag(engine_state, stack, "timeout")?;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use nu_engine::command_prelude::*;
|
use nu_engine::command_prelude::*;
|
||||||
use nu_protocol::{engine::Tag, JobId};
|
use nu_protocol::{engine::FilterTag, JobId};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct JobSend;
|
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)?;
|
let value = input.into_value(head)?;
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ impl Mailbox {
|
|||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
pub fn recv_timeout(
|
pub fn recv_timeout(
|
||||||
&mut self,
|
&mut self,
|
||||||
filter_tag: Option<Tag>,
|
filter_tag: Option<FilterTag>,
|
||||||
timeout: Duration,
|
timeout: Duration,
|
||||||
) -> Result<Value, RecvTimeoutError> {
|
) -> Result<Value, RecvTimeoutError> {
|
||||||
if let Some(value) = self.ignored_mail.pop(filter_tag) {
|
if let Some(value) = self.ignored_mail.pop(filter_tag) {
|
||||||
@ -300,11 +300,11 @@ impl Mailbox {
|
|||||||
struct IgnoredMail {
|
struct IgnoredMail {
|
||||||
next_id: usize,
|
next_id: usize,
|
||||||
messages: BTreeMap<usize, Mail>,
|
messages: BTreeMap<usize, Mail>,
|
||||||
by_tag: HashMap<Tag, BTreeSet<usize>>,
|
by_tag: HashMap<FilterTag, BTreeSet<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Tag = u64;
|
pub type FilterTag = u64;
|
||||||
pub type Mail = (Option<Tag>, Value);
|
pub type Mail = (Option<FilterTag>, Value);
|
||||||
|
|
||||||
impl IgnoredMail {
|
impl IgnoredMail {
|
||||||
pub fn add(&mut self, (tag, value): Mail) {
|
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 {
|
if let Some(tag) = tag {
|
||||||
self.pop_oldest_with_tag(tag)
|
self.pop_oldest_with_tag(tag)
|
||||||
} else {
|
} else {
|
||||||
@ -350,7 +350,7 @@ impl IgnoredMail {
|
|||||||
Some(value)
|
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 ids = self.by_tag.get_mut(&tag)?;
|
||||||
|
|
||||||
let id = ids.pop_first()?;
|
let id = ids.pop_first()?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user