Skip to content

Commit e3a789f

Browse files
committed
add set_uuid as well
1 parent 86abeaf commit e3a789f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ quick-xml = "0.31.0"
1818
newtype-uuid = "1.1.0"
1919
thiserror = "1.0.58"
2020
strip-ansi-escapes = "0.2.0"
21+
uuid = "1.8.0"
2122

2223
[dev-dependencies]
2324
goldenfile = "1.7.1"

src/report.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
use crate::{serialize::serialize_report, SerializeError};
55
use chrono::{DateTime, FixedOffset};
66
use indexmap::map::IndexMap;
7-
use newtype_uuid::{TypedUuid, TypedUuidKind, TypedUuidTag};
7+
use newtype_uuid::{GenericUuid, TypedUuid, TypedUuidKind, TypedUuidTag};
88
use std::{io, iter, time::Duration};
9+
use uuid::Uuid;
910

1011
/// A tag indicating the kind of report.
1112
pub enum ReportKind {}
@@ -72,11 +73,19 @@ impl Report {
7273
/// Sets a unique ID for this `Report`.
7374
///
7475
/// This is an extension that's used by nextest.
75-
pub fn set_uuid(&mut self, uuid: ReportUuid) -> &mut Self {
76+
pub fn set_report_uuid(&mut self, uuid: ReportUuid) -> &mut Self {
7677
self.uuid = Some(uuid);
7778
self
7879
}
7980

81+
/// Sets a unique ID for this `Report` from an untyped [`Uuid`].
82+
///
83+
/// This is an extension that's used by nextest.
84+
pub fn set_uuid(&mut self, uuid: Uuid) -> &mut Self {
85+
self.uuid = Some(ReportUuid::from_untyped_uuid(uuid));
86+
self
87+
}
88+
8089
/// Sets the start timestamp for the report.
8190
pub fn set_timestamp(&mut self, timestamp: impl Into<DateTime<FixedOffset>>) -> &mut Self {
8291
self.timestamp = Some(timestamp.into());

0 commit comments

Comments
 (0)