wire types: WireTime newtype for timestamps instead of adaptor-annotated i64

This commit is contained in:
damocles 2026-07-03 19:18:33 +02:00 committed by mara
commit 1e205289c5
12 changed files with 148 additions and 162 deletions

View file

@ -2018,8 +2018,8 @@ fn schedule_to_wire(s: crate::scheduled_prompts::Schedule) -> hive_sh4re::WireSc
owner: s.owner,
body: s.body,
interval_seconds: s.interval_seconds,
next_fire_at_unix: s.next_fire_at_unix,
created_at_unix: s.created_at_unix,
next_fire_at_unix: hive_sh4re::wire_time::WireTime(s.next_fire_at_unix),
created_at_unix: hive_sh4re::wire_time::WireTime(s.created_at_unix),
source: match s.source {
crate::scheduled_prompts::ScheduleSource::Operator => {
hive_sh4re::WireScheduleSource::Operator
@ -2028,16 +2028,16 @@ fn schedule_to_wire(s: crate::scheduled_prompts::Schedule) -> hive_sh4re::WireSc
hive_sh4re::WireScheduleSource::Approval { id }
}
},
cancelled_at_unix: s.cancelled_at_unix,
paused_at_unix: s.paused_at_unix,
cancelled_at_unix: s.cancelled_at_unix.map(hive_sh4re::wire_time::WireTime),
paused_at_unix: s.paused_at_unix.map(hive_sh4re::wire_time::WireTime),
description: s.description,
targets: s
.targets
.into_iter()
.map(|t| hive_sh4re::WireScheduleTarget {
target: t.target,
cancelled_at_unix: t.cancelled_at_unix,
last_fired_at_unix: t.last_fired_at_unix,
cancelled_at_unix: t.cancelled_at_unix.map(hive_sh4re::wire_time::WireTime),
last_fired_at_unix: t.last_fired_at_unix.map(hive_sh4re::wire_time::WireTime),
last_result: t.last_result,
})
.collect(),
@ -2131,8 +2131,8 @@ mod tests {
owner: "operator".to_owned(),
body: "ping".to_owned(),
interval_seconds: None,
next_fire_at_unix: 0,
created_at_unix: 0,
next_fire_at_unix: hive_sh4re::wire_time::WireTime(0),
created_at_unix: hive_sh4re::wire_time::WireTime(0),
source: hive_sh4re::WireScheduleSource::Operator,
cancelled_at_unix: None,
paused_at_unix: None,