From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../wasi-0.9.0+wasi-snapshot-preview1/src/error.rs | 51 ---------------------- 1 file changed, 51 deletions(-) delete mode 100644 vendor/wasi-0.9.0+wasi-snapshot-preview1/src/error.rs (limited to 'vendor/wasi-0.9.0+wasi-snapshot-preview1/src/error.rs') diff --git a/vendor/wasi-0.9.0+wasi-snapshot-preview1/src/error.rs b/vendor/wasi-0.9.0+wasi-snapshot-preview1/src/error.rs deleted file mode 100644 index 2f2aaf4b9..000000000 --- a/vendor/wasi-0.9.0+wasi-snapshot-preview1/src/error.rs +++ /dev/null @@ -1,51 +0,0 @@ -use super::Errno; -use core::fmt; -use core::num::NonZeroU16; - -/// A raw error returned by wasi APIs, internally containing a 16-bit error -/// code. -#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd)] -pub struct Error { - code: NonZeroU16, -} - -impl Error { - /// Constructs a new error from a raw error code, returning `None` if the - /// error code is zero (which means success). - pub fn from_raw_error(error: Errno) -> Option { - Some(Error { - code: NonZeroU16::new(error)?, - }) - } - - /// Returns the raw error code that this error represents. - pub fn raw_error(&self) -> u16 { - self.code.get() - } -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "{} (error {})", - super::strerror(self.code.get()), - self.code - )?; - Ok(()) - } -} - -impl fmt::Debug for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Error") - .field("code", &self.code) - .field("message", &super::strerror(self.code.get())) - .finish() - } -} - -#[cfg(feature = "std")] -extern crate std; -#[cfg(feature = "std")] -impl std::error::Error for Error {} -- cgit v1.2.3