Skip to content

Commit 308c440

Browse files
committed
release: 2.2.0
2 parents 2ddb566 + 32a2b93 commit 308c440

29 files changed

+252
-176
lines changed

CREDITS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Project Dependencies
22
Package: fyi
3-
Version: 2.1.2
3+
Version: 2.2.0
44
Target: x86_64-unknown-linux-gnu
5-
Generated: 2025-05-30 20:08:04 UTC
5+
Generated: 2025-06-02 03:58:28 UTC
66

77
| Package | Version | Author(s) | License |
88
| ---- | ---- | ---- | ---- |
99
| [**argyle**](https://github.com/Blobfolio/argyle) | 0.12.3 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
10-
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.11.1 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
11-
| [**fyi_ansi**](https://github.com/Blobfolio/fyi) | 2.1.2 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
12-
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 2.1.2 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
10+
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.12.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
11+
| [**fyi_ansi**](https://github.com/Blobfolio/fyi) | 2.2.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
12+
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 2.2.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1313
| [tz-rs](https://github.com/x-hgg-x/tz-rs) | 0.7.0 | x-hgg-x | MIT OR Apache-2.0 |
14-
| [**utc2k**](https://github.com/Blobfolio/utc2k) | 0.13.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
14+
| [**utc2k**](https://github.com/Blobfolio/utc2k) | 0.14.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1515

1616
### Legend
1717

fyi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fyi"
3-
version = "2.1.2"
3+
version = "2.2.0"
44
license = "WTFPL"
55
authors = ["Josh Stoik <josh@blobfolio.com>"]
66
edition = "2024"
@@ -191,7 +191,7 @@ path = "../fyi_msg"
191191

192192
[dependencies]
193193
argyle = "0.12.*"
194-
dactyl = "0.11.*"
194+
dactyl = "0.12.*"
195195

196196
[dependencies.fyi_ansi]
197197
path = "../fyi_ansi"

fyi_ansi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fyi_ansi"
3-
version = "2.1.2"
3+
version = "2.2.0"
44
authors = ["Josh Stoik <josh@blobfolio.com>"]
55
edition = "2024"
66
rust-version = "1.87"

fyi_ansi/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,3 @@ assert_eq!(underline!("I'm underlined!"), "\x1b[4mI'm underlined!\x1b[0m");
4040
assert_eq!(blink!("I'm annoying!"), "\x1b[5mI'm annoying!\x1b[0m");
4141
assert_eq!(strike!("I'm struck!"), "\x1b[9mI'm struck!\x1b[0m");
4242
```
43-
44-
## Stability
45-
46-
This library is currently under development and subject to breaking changes
47-
between dot releases, though the basic API is pretty well set.

fyi_ansi/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ assert_eq!(underline!("I'm underlined!"), "\x1b[4mI'm underlined!\x1b[0m");
4141
assert_eq!(blink!("I'm annoying!"), "\x1b[5mI'm annoying!\x1b[0m");
4242
assert_eq!(strike!("I'm struck!"), "\x1b[9mI'm struck!\x1b[0m");
4343
```
44-
45-
## Stability
46-
47-
This library is currently under development and subject to breaking changes
48-
between dot releases, though the basic API is pretty well set.
4944
*/
5045

5146
#![forbid(unsafe_code)]

fyi_msg/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fyi_msg"
3-
version = "2.1.2"
3+
version = "2.2.0"
44
authors = ["Josh Stoik <josh@blobfolio.com>"]
55
edition = "2024"
66
rust-version = "1.87"
@@ -18,11 +18,11 @@ default-target = "x86_64-unknown-linux-gnu"
1818
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin" ]
1919

2020
[dependencies.dactyl]
21-
version = "0.11.*"
21+
version = "0.12.*"
2222
optional = true
2323

2424
[dependencies.fyi_ansi]
25-
version = "2.1.2"
25+
version = "2.2.*"
2626
path = "../fyi_ansi"
2727

2828
[dependencies.signal-hook]
@@ -39,7 +39,7 @@ version = "0.2.*"
3939
optional = true
4040

4141
[dependencies.utc2k]
42-
version = "0.13.*"
42+
version = "0.14.*"
4343
features = [ "local" ]
4444
optional = true
4545

fyi_msg/examples/progless-par.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
.map(|&t| (t, Duration::from_millis(t.len() as u64 * 3)))
3939
.for_each(|(txt, delay)| {
4040
// Start a new task.
41-
pbar.add(txt);
41+
let task = pbar.task(txt);
4242

4343
// Example `push_msg` usage.
4444
if txt.starts_with("message/") {
@@ -50,8 +50,8 @@ fn main() {
5050
// Simulate work.
5151
std::thread::sleep(delay);
5252

53-
// Remove said task, which increments the "done" count by one.
54-
pbar.remove(txt);
53+
// Remove said task, incrementing the done count by one.
54+
drop(task);
5555
});
5656

5757
// Let's do it again! We could start a new Progless, but let's keep the
@@ -69,12 +69,12 @@ fn main() {
6969
nums.into_par_iter()
7070
.for_each(|n| {
7171
let nice = NiceU16::from(n);
72-
pbar.add(nice.as_str());
72+
let task = pbar.task(nice.as_str());
7373

7474
// Simulate work.
7575
std::thread::sleep(Duration::from_millis(99));
7676

77-
pbar.remove(nice.as_str());
77+
drop(task);
7878
});
7979

8080
// We're really done now.

fyi_msg/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ pub use progress::{
127127
ba::BeforeAfter,
128128
Progless,
129129
error::ProglessError,
130+
guard::ProglessTaskGuard,
130131
};
131132

132133
// Re-export.
134+
pub use fyi_ansi;
133135
#[cfg_attr(docsrs, doc(cfg(feature = "signal-hook")))]
134136
#[cfg(feature = "signal-hook")] pub use signal_hook;
135137

fyi_msg/src/msg/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,8 @@ impl Msg {
690690
pub fn set_timestamp(&mut self, enabled: bool) {
691691
if enabled {
692692
let now = utc2k::FmtUtc2k::now_local();
693-
let mut out = String::with_capacity(24 + now.len());
694-
out.push_str(csi!(dim));
695-
out.push('[');
696-
out.push_str(csi!(reset, blue));
693+
let mut out = String::with_capacity(43);
694+
out.push_str(concat!(csi!(dim), "[", csi!(reset, blue)));
697695
out.push_str(now.as_str());
698696
out.push_str(concat!(ansi!((reset, dim) "]"), " "));
699697
self.replace_part(TocId::Timestamp, &out);

fyi_msg/src/progress/guard.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*!
2+
# FYI Msg - Progless Increment Guard.
3+
*/
4+
5+
use std::sync::Arc;
6+
use super::ProglessInner;
7+
8+
#[expect(unused_imports, reason = "For docs.")]
9+
use super::Progless;
10+
11+
12+
13+
#[derive(Debug)]
14+
/// # Progless Task Guard.
15+
///
16+
/// This guard is returned by [`Progless::task`].
17+
///
18+
/// When dropped, the task will automatically be removed from the [`Progless`]
19+
/// output and the done count will be increased by one.
20+
///
21+
/// To drop it _without_ incrementing the done count — because you e.g.
22+
/// changed your mind or need to come back to it later — use
23+
/// [`ProglessTaskGuard::cancel`].
24+
pub struct ProglessTaskGuard<'a> {
25+
/// # Task Name.
26+
task: String,
27+
28+
/// # Increment on Drop?
29+
inc: bool,
30+
31+
/// # Cycle Number.
32+
///
33+
/// This value is used to prevent a guard from one [`Progless`] cycle
34+
/// affecting the totals of a subsequent one (after e.g. a reset).
35+
cycle: u8,
36+
37+
/// # Linked [`Progless`] Instance.
38+
progress: &'a Arc<ProglessInner>,
39+
}
40+
41+
impl Drop for ProglessTaskGuard<'_> {
42+
#[inline]
43+
fn drop(&mut self) {
44+
self.progress.remove_guard(self.task.as_str(), self.cycle, self.inc);
45+
}
46+
}
47+
48+
impl<'a> ProglessTaskGuard<'a> {
49+
/// # From Parts.
50+
pub(super) const fn from_parts(
51+
task: String,
52+
cycle: u8,
53+
progress: &'a Arc<ProglessInner>,
54+
) -> Self {
55+
Self { task, inc: true, cycle, progress }
56+
}
57+
58+
#[inline]
59+
/// # Cancel Guard.
60+
///
61+
/// Remove the task from the [`Progless`] output _without_ incrementing
62+
/// the done count.
63+
pub fn cancel(mut self) {
64+
self.inc = false;
65+
drop(self);
66+
}
67+
}

0 commit comments

Comments
 (0)