ifc_lite_geometry_runtime/
runtime_owner.rs1use crate::process_control::ProcessControl;
4
5#[derive(Clone)]
7pub struct RuntimeOwner {
8 control: ProcessControl,
9 incarnation: u64,
10}
11
12impl RuntimeOwner {
13 #[cfg(feature = "retained-runtime")]
16 pub fn same_domain(&self, other: &Self) -> bool { self.control.same_domain(&other.control) }
17 pub(crate) fn new(control: ProcessControl, incarnation: u64) -> Self {
18 Self {
19 control,
20 incarnation,
21 }
22 }
23
24 pub fn retire(&self) {
27 if let Err(error) = self.control.terminate() {
28 eprintln!("geometry runtime owner retirement/reap failed: {error}");
29 }
30 }
31
32 pub fn incarnation(&self) -> Option<u64> {
35 self.control.is_live().then_some(self.incarnation)
36 }
37}
38
39impl std::fmt::Debug for RuntimeOwner {
40 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41 f.debug_struct("RuntimeOwner")
42 .field("incarnation", &self.incarnation())
43 .finish()
44 }
45}