ProgramInputError
Identifies startup snapshot description, copy and environment parsing failure. A failed decoder returns no partial payload and does not release the borrowed native snapshot. Native startup owns capture/release. Error values retain no foreign pointer, errno or unit view. Invalid Unicode is preserved until an explicit text conversion, never rejected merely by snapshot decoding.
Module std.process
import std.process;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
ProgramInputError
pub enum ProgramInputErrorIdentifies startup snapshot description, copy and environment parsing failure. A failed decoder returns no partial payload and does not release the borrowed native snapshot. Native startup owns capture/release. Error values retain no foreign pointer, errno or unit view. Invalid Unicode is preserved until an explicit text conversion, never rejected merely by snapshot decoding.
Example
module example.program_input_error;
from std.process import ProgramInputError;
fn StartupStatus(Error: ProgramInputError) -> i32 {
// Match one enum layer at a time while preserving each original fallback.
switch Error {
case .InvalidInput => return 10;
case .NativeFailure => return 11;
case .CapacityExceeded => return 12;
case .InvalidEnvironmentEntry => return 13;
case .Storage { Reason = PatternPayload5077 } if (PatternPayload5077 is .OutOfMemory) => return 14;
case .Text { Reason = PatternPayload5078 } if (PatternPayload5078 is .EmbeddedNul) => return 15;
case .Environment { Reason = PatternPayload5079 } => {
switch PatternPayload5079 {
case .InvalidName => return 16;
case .Windows { Reason = PatternPayload5080 } if (PatternPayload5080 is .Unsupported) => return 18;
default => return 17;
}
}
default => return 17;
}
}
fn Main() -> i32 {
// Route typed startup failures without formatting foreign pointers or errno.
// Actual generated startup delivery is a separate native integration proof.
if StartupStatus(.InvalidInput) != 10 || StartupStatus(.NativeFailure) != 11 ||
StartupStatus(.CapacityExceeded) != 12 || StartupStatus(.InvalidEnvironmentEntry) != 13 { return 1; }
if StartupStatus(.Storage { Reason = .OutOfMemory }) != 14 ||
StartupStatus(.Text { Reason = .EmbeddedNul }) != 15 ||
StartupStatus(.Environment { Reason = .InvalidName }) != 16 { return 2; }
if StartupStatus(.Text { Reason = .InvalidUtf16 }) != 17 { return 3; }
if StartupStatus(.Environment { Reason = .Windows { Reason = .Unsupported } }) != 18 { return 4; }
return 0;
}ProgramInputError.InvalidInput
InvalidInput;Malformed description, pointer shape or encoding.
ProgramInputError.NativeFailure
NativeFailure;Native snapshot query failed unexpectedly.
ProgramInputError.CapacityExceeded
CapacityExceeded;Unit count exceeds the signed pointer-offset domain.
ProgramInputError.InvalidEnvironmentEntry
InvalidEnvironmentEntry;Raw environment entry lacks '=' or has an empty name.
ProgramInputError.Storage
Storage;Argument/environment owner storage could not be reserved.
ProgramInputError.Storage.Reason
Reason: AllocationError;ProgramInputError.Text
Text;Exact native text copy failed due to NUL/storage validation.
ProgramInputError.Text.Reason
Reason: NativeStringError;ProgramInputError.Environment
Environment;Checked environment insertion rejected a name/representation/storage request.
ProgramInputError.Environment.Reason
Reason: EnvironmentSetErrorReason;