feature. See also
. The project being documented here (as the example) is the Zig library itself.
status.Status
pub const Status = enum(usize)
File
Code
pub const Status = enum(usize) {
success = 0,
load_error = high_bit | 1,
invalid_parameter = high_bit | 2,
unsupported = high_bit | 3,
bad_buffer_size = high_bit | 4,
buffer_too_small = high_bit | 5,
not_ready = high_bit | 6,
device_error = high_bit | 7,
write_protected = high_bit | 8,
out_of_resources = high_bit | 9,
volume_corrupted = high_bit | 10,
volume_full = high_bit | 11,
no_media = high_bit | 12,
media_changed = high_bit | 13,
not_found = high_bit | 14,
access_denied = high_bit | 15,
no_response = high_bit | 16,
no_mapping = high_bit | 17,
timeout = high_bit | 18,
not_started = high_bit | 19,
already_started = high_bit | 20,
aborted = high_bit | 21,
icmp_error = high_bit | 22,
tftp_error = high_bit | 23,
protocol_error = high_bit | 24,
incompatible_version = high_bit | 25,
security_violation = high_bit | 26,
crc_error = high_bit | 27,
end_of_media = high_bit | 28,
end_of_file = high_bit | 31,
invalid_language = high_bit | 32,
compromised_data = high_bit | 33,
ip_address_conflict = high_bit | 34,
http_error = high_bit | 35,
network_unreachable = high_bit | 100,
host_unreachable = high_bit | 101,
protocol_unreachable = high_bit | 102,
port_unreachable = high_bit | 103,
connection_fin = high_bit | 104,
connection_reset = high_bit | 105,
connection_refused = high_bit | 106,
warn_unknown_glyph = 1,
warn_delete_failure = 2,
warn_write_failure = 3,
warn_buffer_too_small = 4,
warn_stale_data = 5,
warn_file_system = 6,
warn_reset_required = 7,
_,
pub const Error = error{
LoadError,
InvalidParameter,
Unsupported,
BadBufferSize,
BufferTooSmall,
NotReady,
DeviceError,
WriteProtected,
OutOfResources,
VolumeCorrupted,
VolumeFull,
NoMedia,
MediaChanged,
NotFound,
AccessDenied,
NoResponse,
NoMapping,
Timeout,
NotStarted,
AlreadyStarted,
Aborted,
IcmpError,
TftpError,
ProtocolError,
IncompatibleVersion,
SecurityViolation,
CrcError,
EndOfMedia,
EndOfFile,
InvalidLanguage,
CompromisedData,
IpAddressConflict,
HttpError,
NetworkUnreachable,
HostUnreachable,
ProtocolUnreachable,
PortUnreachable,
ConnectionFin,
ConnectionReset,
ConnectionRefused,
};
pub fn err(self: Status) Error!void {
switch (self) {
.load_error => return error.LoadError,
.invalid_parameter => return error.InvalidParameter,
.unsupported => return error.Unsupported,
.bad_buffer_size => return error.BadBufferSize,
.buffer_too_small => return error.BufferTooSmall,
.not_ready => return error.NotReady,
.device_error => return error.DeviceError,
.write_protected => return error.WriteProtected,
.out_of_resources => return error.OutOfResources,
.volume_corrupted => return error.VolumeCorrupted,
.volume_full => return error.VolumeFull,
.no_media => return error.NoMedia,
.media_changed => return error.MediaChanged,
.not_found => return error.NotFound,
.access_denied => return error.AccessDenied,
.no_response => return error.NoResponse,
.no_mapping => return error.NoMapping,
.timeout => return error.Timeout,
.not_started => return error.NotStarted,
.already_started => return error.AlreadyStarted,
.aborted => return error.Aborted,
.icmp_error => return error.IcmpError,
.tftp_error => return error.TftpError,
.protocol_error => return error.ProtocolError,
.incompatible_version => return error.IncompatibleVersion,
.security_violation => return error.SecurityViolation,
.crc_error => return error.CrcError,
.end_of_media => return error.EndOfMedia,
.end_of_file => return error.EndOfFile,
.invalid_language => return error.InvalidLanguage,
.compromised_data => return error.CompromisedData,
.ip_address_conflict => return error.IpAddressConflict,
.http_error => return error.HttpError,
.network_unreachable => return error.NetworkUnreachable,
.host_unreachable => return error.HostUnreachable,
.protocol_unreachable => return error.ProtocolUnreachable,
.port_unreachable => return error.PortUnreachable,
.connection_fin => return error.ConnectionFin,
.connection_reset => return error.ConnectionReset,
.connection_refused => return error.ConnectionRefused,
else => {},
}
}
pub fn fromError(e: Error) Status {
return switch (e) {
Error.Aborted => .aborted,
Error.AccessDenied => .access_denied,
Error.AlreadyStarted => .already_started,
Error.BadBufferSize => .bad_buffer_size,
Error.BufferTooSmall => .buffer_too_small,
Error.CompromisedData => .compromised_data,
Error.ConnectionFin => .connection_fin,
Error.ConnectionRefused => .connection_refused,
Error.ConnectionReset => .connection_reset,
Error.CrcError => .crc_error,
Error.DeviceError => .device_error,
Error.EndOfFile => .end_of_file,
Error.EndOfMedia => .end_of_media,
Error.HostUnreachable => .host_unreachable,
Error.HttpError => .http_error,
Error.IcmpError => .icmp_error,
Error.IncompatibleVersion => .incompatible_version,
Error.InvalidLanguage => .invalid_language,
Error.InvalidParameter => .invalid_parameter,
Error.IpAddressConflict => .ip_address_conflict,
Error.LoadError => .load_error,
Error.MediaChanged => .media_changed,
Error.NetworkUnreachable => .network_unreachable,
Error.NoMapping => .no_mapping,
Error.NoMedia => .no_media,
Error.NoResponse => .no_response,
Error.NotFound => .not_found,
Error.NotReady => .not_ready,
Error.NotStarted => .not_started,
Error.OutOfResources => .out_of_resources,
Error.PortUnreachable => .port_unreachable,
Error.ProtocolError => .protocol_error,
Error.ProtocolUnreachable => .protocol_unreachable,
Error.SecurityViolation => .security_violation,
Error.TftpError => .tftp_error,
Error.Timeout => .timeout,
Error.Unsupported => .unsupported,
Error.VolumeCorrupted => .volume_corrupted,
Error.VolumeFull => .volume_full,
Error.WriteProtected => .write_protected,
};
}
}