reuse the host::* consts in enum Error

This commit is contained in:
Marcin Mielniczuk
2019-09-08 18:48:59 +02:00
committed by Jakub Konka
parent c5339d01cf
commit 612617b0ba

View File

@@ -5,84 +5,85 @@ use std::fmt;
use std::num::TryFromIntError; use std::num::TryFromIntError;
#[derive(Clone, Copy, Debug, Fail)] #[derive(Clone, Copy, Debug, Fail)]
#[repr(u16)]
pub enum WasiError { pub enum WasiError {
ESUCCESS = 0, ESUCCESS = host::__WASI_ESUCCESS,
E2BIG = 1, E2BIG = host::__WASI_E2BIG,
EACCES = 2, EACCES = host::__WASI_EACCES,
EADDRINUSE = 3, EADDRINUSE = host::__WASI_EADDRINUSE,
EADDRNOTAVAIL = 4, EADDRNOTAVAIL = host::__WASI_EADDRNOTAVAIL,
EAFNOSUPPORT = 5, EAFNOSUPPORT = host::__WASI_EAFNOSUPPORT,
EAGAIN = 6, EAGAIN = host::__WASI_EAGAIN,
EALREADY = 7, EALREADY = host::__WASI_EALREADY,
EBADF = 8, EBADF = host::__WASI_EBADF,
EBADMSG = 9, EBADMSG = host::__WASI_EBADMSG,
EBUSY = 10, EBUSY = host::__WASI_EBUSY,
ECANCELED = 11, ECANCELED = host::__WASI_ECANCELED,
ECHILD = 12, ECHILD = host::__WASI_ECHILD,
ECONNABORTED = 13, ECONNABORTED = host::__WASI_ECONNABORTED,
ECONNREFUSED = 14, ECONNREFUSED = host::__WASI_ECONNREFUSED,
ECONNRESET = 15, ECONNRESET = host::__WASI_ECONNRESET,
EDEADLK = 16, EDEADLK = host::__WASI_EDEADLK,
EDESTADDRREQ = 17, EDESTADDRREQ = host::__WASI_EDESTADDRREQ,
EDOM = 18, EDOM = host::__WASI_EDOM,
EDQUOT = 19, EDQUOT = host::__WASI_EDQUOT,
EEXIST = 20, EEXIST = host::__WASI_EEXIST,
EFAULT = 21, EFAULT = host::__WASI_EFAULT,
EFBIG = 22, EFBIG = host::__WASI_EFBIG,
EHOSTUNREACH = 23, EHOSTUNREACH = host::__WASI_EHOSTUNREACH,
EIDRM = 24, EIDRM = host::__WASI_EIDRM,
EILSEQ = 25, EILSEQ = host::__WASI_EILSEQ,
EINPROGRESS = 26, EINPROGRESS = host::__WASI_EINPROGRESS,
EINTR = 27, EINTR = host::__WASI_EINTR,
EINVAL = 28, EINVAL = host::__WASI_EINVAL,
EIO = 29, EIO = host::__WASI_EIO,
EISCONN = 30, EISCONN = host::__WASI_EISCONN,
EISDIR = 31, EISDIR = host::__WASI_EISDIR,
ELOOP = 32, ELOOP = host::__WASI_ELOOP,
EMFILE = 33, EMFILE = host::__WASI_EMFILE,
EMLINK = 34, EMLINK = host::__WASI_EMLINK,
EMSGSIZE = 35, EMSGSIZE = host::__WASI_EMSGSIZE,
EMULTIHOP = 36, EMULTIHOP = host::__WASI_EMULTIHOP,
ENAMETOOLONG = 37, ENAMETOOLONG = host::__WASI_ENAMETOOLONG,
ENETDOWN = 38, ENETDOWN = host::__WASI_ENETDOWN,
ENETRESET = 39, ENETRESET = host::__WASI_ENETRESET,
ENETUNREACH = 40, ENETUNREACH = host::__WASI_ENETUNREACH,
ENFILE = 41, ENFILE = host::__WASI_ENFILE,
ENOBUFS = 42, ENOBUFS = host::__WASI_ENOBUFS,
ENODEV = 43, ENODEV = host::__WASI_ENODEV,
ENOENT = 44, ENOENT = host::__WASI_ENOENT,
ENOEXEC = 45, ENOEXEC = host::__WASI_ENOEXEC,
ENOLCK = 46, ENOLCK = host::__WASI_ENOLCK,
ENOLINK = 47, ENOLINK = host::__WASI_ENOLINK,
ENOMEM = 48, ENOMEM = host::__WASI_ENOMEM,
ENOMSG = 49, ENOMSG = host::__WASI_ENOMSG,
ENOPROTOOPT = 50, ENOPROTOOPT = host::__WASI_ENOPROTOOPT,
ENOSPC = 51, ENOSPC = host::__WASI_ENOSPC,
ENOSYS = 52, ENOSYS = host::__WASI_ENOSYS,
ENOTCONN = 53, ENOTCONN = host::__WASI_ENOTCONN,
ENOTDIR = 54, ENOTDIR = host::__WASI_ENOTDIR,
ENOTEMPTY = 55, ENOTEMPTY = host::__WASI_ENOTEMPTY,
ENOTRECOVERABLE = 56, ENOTRECOVERABLE = host::__WASI_ENOTRECOVERABLE,
ENOTSOCK = 57, ENOTSOCK = host::__WASI_ENOTSOCK,
ENOTSUP = 58, ENOTSUP = host::__WASI_ENOTSUP,
ENOTTY = 59, ENOTTY = host::__WASI_ENOTTY,
ENXIO = 60, ENXIO = host::__WASI_ENXIO,
EOVERFLOW = 61, EOVERFLOW = host::__WASI_EOVERFLOW,
EOWNERDEAD = 62, EOWNERDEAD = host::__WASI_EOWNERDEAD,
EPERM = 63, EPERM = host::__WASI_EPERM,
EPIPE = 64, EPIPE = host::__WASI_EPIPE,
EPROTO = 65, EPROTO = host::__WASI_EPROTO,
EPROTONOSUPPORT = 66, EPROTONOSUPPORT = host::__WASI_EPROTONOSUPPORT,
EPROTOTYPE = 67, EPROTOTYPE = host::__WASI_EPROTOTYPE,
ERANGE = 68, ERANGE = host::__WASI_ERANGE,
EROFS = 69, EROFS = host::__WASI_EROFS,
ESPIPE = 70, ESPIPE = host::__WASI_ESPIPE,
ESRCH = 71, ESRCH = host::__WASI_ESRCH,
ESTALE = 72, ESTALE = host::__WASI_ESTALE,
ETIMEDOUT = 73, ETIMEDOUT = host::__WASI_ETIMEDOUT,
ETXTBSY = 74, ETXTBSY = host::__WASI_ETXTBSY,
EXDEV = 75, EXDEV = host::__WASI_EXDEV,
ENOTCAPABLE = 76, ENOTCAPABLE = host::__WASI_ENOTCAPABLE,
} }
impl WasiError { impl WasiError {