#[repr(i32)]pub enum ExitCode {
Show 19 variants
Success = 0,
Error = 1,
UsageError = 64,
DataError = 65,
NoInput = 66,
NoUser = 67,
NoHost = 68,
Unavailable = 69,
Software = 70,
OsError = 71,
OsFile = 72,
CantCreate = 73,
IoError = 74,
TempFail = 75,
Protocol = 76,
NoPerm = 77,
Config = 78,
Interrupted = 130,
Terminated = 143,
}Expand description
Exit codes following Unix conventions (BSD sysexits.h)
Variants§
Success = 0
Successful termination (0)
Error = 1
General error (1)
UsageError = 64
Command line usage error (64)
- Invalid arguments
- Missing required arguments
- Unknown flags
DataError = 65
Data format error (65)
- Invalid input data
- Malformed configuration
- Parse errors
NoInput = 66
Cannot open input (66)
- File not found
- Cannot read file
- Permission denied on input
NoUser = 67
User does not exist (67)
- Unknown user specified
- Invalid user context
NoHost = 68
Host name unknown (68)
- Unknown host
- Cannot resolve hostname
Service unavailable (69)
- Required service not running
- Dependency not available
- External service unreachable
Software = 70
Internal software error (70)
- Unexpected error
- Assertion failure
- Internal consistency check failed
OsError = 71
System error (71)
- OS error
- System call failed
- Fork failed
OsFile = 72
Critical OS file missing (72)
- Required system file not found
- Missing configuration file
CantCreate = 73
Cannot create output file (73)
- Cannot write output
- Disk full
- Permission denied on output
IoError = 74
I/O error (74)
- Read error
- Write error
- Network I/O error
TempFail = 75
Temporary failure, retry (75)
- Resource temporarily unavailable
- Retry operation
Protocol = 76
Remote error in protocol (76)
- Protocol violation
- Invalid response
- Communication error
NoPerm = 77
Permission denied (77)
- Insufficient privileges
- Access denied
- Not authorized
Config = 78
Configuration error (78)
- Invalid configuration
- Missing required configuration
- Configuration validation failed
Interrupted = 130
Interrupted by signal (SIGINT - Ctrl+C) (130)
- User interrupted (Ctrl+C)
- SIGINT received
Terminated = 143
Terminated by signal (SIGTERM) (143)
- SIGTERM received
- Graceful shutdown requested
Implementations§
Source§impl ExitCode
impl ExitCode
Sourcepub fn from_error(error: &dyn Error) -> Self
pub fn from_error(error: &dyn Error) -> Self
Create ExitCode from error type
Maps common error types to appropriate exit codes:
- I/O errors → IoError (74)
- Parse errors → DataError (65)
- Permission errors → NoPerm (77)
- Not found errors → NoInput (66)
- Invalid argument → UsageError (64)
- Other errors → Error (1)
Sourcepub fn description(self) -> &'static str
pub fn description(self) -> &'static str
Get human-readable description of exit code
Sourcepub fn is_success(self) -> bool
pub fn is_success(self) -> bool
Check if this is a success exit code
Trait Implementations§
impl Copy for ExitCode
impl Eq for ExitCode
impl StructuralPartialEq for ExitCode
Auto Trait Implementations§
impl Freeze for ExitCode
impl RefUnwindSafe for ExitCode
impl Send for ExitCode
impl Sync for ExitCode
impl Unpin for ExitCode
impl UnwindSafe for ExitCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more