pub struct HostId { /* private fields */ }Expand description
A stable host identifier.
A HostId is always a UUID, but wraps additional provenance: which source
produced the raw value and whether the host was running inside a container
at resolution time. The wire representation (via HostId::as_uuid or
fmt::Display) is the hyphenated UUID string.
Implementations§
Source§impl HostId
impl HostId
Sourcepub fn source(&self) -> SourceKind
pub fn source(&self) -> SourceKind
Which source the raw value was read from.
Sourcepub fn in_container(&self) -> bool
pub fn in_container(&self) -> bool
Whether the resolver detected a container runtime at resolution time.
When true, HostId::source reflects the container branch rather
than a host-level source.
On non-Linux targets this is always false — container-runtime
detection is implemented via /.dockerenv and /proc/1/cgroup,
both Linux-only. A macOS or Windows host running Docker Desktop
will still report false because the host process itself is not
inside the container namespace.
Sourcepub fn summary(&self) -> HostIdSummary<'_>
pub fn summary(&self) -> HostIdSummary<'_>
Log-friendly summary combining source kind and UUID.
Returns a value that implements fmt::Display as
"{source_kind}:{uuid}", e.g. "aws-imds:i-0abc…" becomes
"aws-imds:12345678-1234-…" after wrapping. Keeps HostId’s own
Display impl wire-clean (just the UUID) while giving operators
the provenance tag they usually want in logs.
let s = id.summary().to_string();
assert!(s.starts_with("env-override:"));