Loading crates/s3s/src/error/mod.rs +13 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use crate::xml; use std::borrow::Cow; use std::fmt; use std::io::Write; use std::str::FromStr; pub type S3Result<T = (), E = S3Error> = std::result::Result<T, E>; Loading Loading @@ -149,3 +150,15 @@ macro_rules! s3_error { $crate::S3Error::with_message($crate::S3ErrorCode::$code, format!($fmt, $($arg)+)) }; } #[derive(Debug, thiserror::Error)] #[error("Unknown S3 Error Code")] pub struct ParseS3ErrorCodeError(()); impl FromStr for S3ErrorCode { type Err = ParseS3ErrorCodeError; fn from_str(s: &str) -> Result<Self, Self::Err> { Self::from_bytes(s.as_bytes()).ok_or(ParseS3ErrorCodeError(())) } } Loading
crates/s3s/src/error/mod.rs +13 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use crate::xml; use std::borrow::Cow; use std::fmt; use std::io::Write; use std::str::FromStr; pub type S3Result<T = (), E = S3Error> = std::result::Result<T, E>; Loading Loading @@ -149,3 +150,15 @@ macro_rules! s3_error { $crate::S3Error::with_message($crate::S3ErrorCode::$code, format!($fmt, $($arg)+)) }; } #[derive(Debug, thiserror::Error)] #[error("Unknown S3 Error Code")] pub struct ParseS3ErrorCodeError(()); impl FromStr for S3ErrorCode { type Err = ParseS3ErrorCodeError; fn from_str(s: &str) -> Result<Self, Self::Err> { Self::from_bytes(s.as_bytes()).ok_or(ParseS3ErrorCodeError(())) } }