1use core::fmt;
2use embedded_i18n::t;
3
4use crate::Kind;
5
6impl fmt::Display for Kind {
7 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8 let message = match self {
9 Self::InvalidArgument => t!("errors.invalid_argument"),
10 Self::InvalidData => t!("errors.invalid_data"),
11 Self::PermissionDenied => t!("errors.permission_denied"),
12 Self::OperationNotPermitted => t!("errors.operation_not_permitted"),
13 Self::InputOutput => t!("errors.input_output"),
14 Self::OutOfMemory => t!("errors.out_of_memory"),
15 Self::WouldBlock => t!("errors.would_block"),
16 Self::ResourceBusy => t!("errors.resource_busy"),
17 Self::Interrupted => t!("errors.interrupted"),
18 Self::TimedOut => t!("errors.timed_out"),
19 Self::Unsupported => t!("errors.unsupported"),
20 Self::Overflow => t!("errors.overflow"),
21 Self::WriteZero => t!("errors.write_zero"),
22 Self::NoBuffers => t!("errors.no_buffers"),
23 Self::NotFound => t!("errors.not_found"),
24 Self::AlreadyExists => t!("errors.already_exists"),
25 Self::InvalidFlags => t!("errors.invalid_flags"),
26 Self::InvalidState => t!("errors.invalid_state"),
27 Self::NotImplemented => t!("errors.not_implemented"),
28 Self::ExecFormat => t!("errors.exec_format"),
29 Self::NoChild => t!("errors.no_child"),
30 Self::ArgumentListTooLong => t!("errors.argument_list_too_long"),
31 Self::Deadlock => t!("errors.deadlock"),
32 Self::BadDescriptor => t!("errors.bad_descriptor"),
33 Self::InvalidPath => t!("errors.invalid_path"),
34 Self::MissingPathComponent => t!("errors.missing_path_component"),
35 Self::MissingFinalEntry => t!("errors.missing_final_entry"),
36 Self::NameTooLong => t!("errors.name_too_long"),
37 Self::SymlinkLoop => t!("errors.symlink_loop"),
38 Self::NotADirectory => t!("errors.not_a_directory"),
39 Self::IsADirectory => t!("errors.is_a_directory"),
40 Self::DirectoryNotEmpty => t!("errors.directory_not_empty"),
41 Self::NoSpace => t!("errors.no_space"),
42 Self::FileTooLarge => t!("errors.file_too_large"),
43 Self::ProcessFileLimit => t!("errors.process_file_limit"),
44 Self::SystemFileLimit => t!("errors.system_file_limit"),
45 Self::CrossDevice => t!("errors.cross_device"),
46 Self::PathEscapesRoot => t!("errors.path_escapes_root"),
47 Self::CorruptData => t!("errors.corrupt_data"),
48 Self::MissingAttribute => t!("errors.missing_attribute"),
49 Self::StaleHandle => t!("errors.stale_handle"),
50 Self::ReadOnlyFileSystem => t!("errors.read_only_file_system"),
51 Self::InvalidSeek => t!("errors.invalid_seek"),
52 Self::DeviceUnavailable => t!("errors.device_unavailable"),
53 Self::NoSuchTask => t!("errors.no_such_task"),
54 Self::InappropriateIoControl => t!("errors.inappropriate_io_control"),
55 Self::ConnectionRefused => t!("errors.connection_refused"),
56 Self::ConnectionReset => t!("errors.connection_reset"),
57 Self::ConnectionAborted => t!("errors.connection_aborted"),
58 Self::NotConnected => t!("errors.not_connected"),
59 Self::AlreadyConnected => t!("errors.already_connected"),
60 Self::AddressInUse => t!("errors.address_in_use"),
61 Self::AddressNotAvailable => t!("errors.address_not_available"),
62 Self::DestinationRequired => t!("errors.destination_required"),
63 Self::HostUnreachable => t!("errors.host_unreachable"),
64 Self::NetworkUnreachable => t!("errors.network_unreachable"),
65 Self::NetworkDown => t!("errors.network_down"),
66 Self::BrokenPipe => t!("errors.broken_pipe"),
67 Self::MessageTooLarge => t!("errors.message_too_large"),
68 Self::DatagramTruncated => t!("errors.datagram_truncated"),
69 Self::SocketOperationUnsupported => t!("errors.socket_operation_unsupported"),
70 Self::ProtocolUnsupported => t!("errors.protocol_unsupported"),
71 Self::AddressFamilyUnsupported => t!("errors.address_family_unsupported"),
72 Self::InProgress => t!("errors.in_progress"),
73 Self::AlreadyInProgress => t!("errors.already_in_progress"),
74 Self::ProtocolError => t!("errors.protocol_error"),
75 Self::NotASocket => t!("errors.not_a_socket"),
76 Self::InvalidDnsName => t!("errors.invalid_dns_name"),
77 Self::UnsupportedDnsQuery => t!("errors.unsupported_dns_query"),
78 Self::NameNotResolved => t!("errors.name_not_resolved"),
79 Self::ResolverTemporaryFailure => t!("errors.resolver_temporary_failure"),
80 Self::ResolverFailure => t!("errors.resolver_failure"),
81 };
82 f.write_str(message)
83 }
84}