#[non_exhaustive]pub enum ManagerFailureKind {
Spawn,
Timeout,
Permission,
NotFound,
Protocol,
LocalFilesystem,
}Expand description
Machine-readable classification of a manager failure.
The kind — not the detail text — is the carrier of meaning. A consumer distinguishes “the manager timed out” from “the manager binary is missing” from “you lack privileges” by matching this value; nothing in this crate classifies a failure by substring-matching its own error text.
Every ServiceError::Manager construction site in this crate maps to
exactly one kind. There is no “unclassified” fallback.
§Known limitation
A manager that runs and reports an access denial in its own stderr is
ManagerFailureKind::Protocol, because the platform supplied no
structured denial. Only a structured platform denial — a Unix
std::io::ErrorKind::PermissionDenied from the spawn path, or a Windows
SCM access-denied code — is ManagerFailureKind::Permission.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Spawn
The manager child could not be created or driven.
Timeout
A deadline expired before or during a manager command.
Permission
The platform reported an access denial.
NotFound
The manager program, or a manager resource it names, does not exist.
Protocol
The manager ran and produced a result this crate cannot accept: a non-zero exit on a mutation, malformed manager output, or an output bound violation.
LocalFilesystem
A local filesystem operation failed (definition write, unit removal).
Implementations§
Source§impl ManagerFailureKind
impl ManagerFailureKind
Sourcepub fn from_spawn_error(error: &Error) -> Self
pub fn from_spawn_error(error: &Error) -> Self
Classifies a manager child-creation failure from an operating-system error.
NotFound maps to ManagerFailureKind::NotFound, PermissionDenied
maps to ManagerFailureKind::Permission, and every other error kind
maps to ManagerFailureKind::Spawn. This is a pure function: it
never inspects a message and never needs a real privilege failure.
Sourcepub fn from_scm_os_code(code: Option<i32>) -> Self
pub fn from_scm_os_code(code: Option<i32>) -> Self
Classifies a Windows SCM (Win32) OS error code.
5 (access denied) maps to ManagerFailureKind::Permission, 1060
(the specified service does not exist) maps to
ManagerFailureKind::NotFound, and every other code maps to
ManagerFailureKind::Protocol. This is a pure function and is
platform-independent, so it is assertable on every lane.