Skip to main content

ManagerFailureKind

Enum ManagerFailureKind 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for ManagerFailureKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ManagerFailureKind

Source§

impl Debug for ManagerFailureKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ManagerFailureKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ManagerFailureKind

Source§

impl PartialEq for ManagerFailureKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ManagerFailureKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.