mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
A MsgId newtype
This more strongly types the ubiquitous message id type by no longer making it an integer. It keeps the actual ID opaque. Only for the generic job API the number keeps being used. Some locations also need to create it from an integer and call MsgId::new().
This commit is contained in:
committed by
holger krekel
parent
c6adbe939d
commit
c8d296ea0e
@@ -32,6 +32,8 @@ pub enum Error {
|
||||
FromUtf8(std::string::FromUtf8Error),
|
||||
#[fail(display = "{}", _0)]
|
||||
BlobError(#[cause] crate::blob::BlobError),
|
||||
#[fail(display = "Invalid Message ID.")]
|
||||
InvalidMsgId,
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
@@ -102,6 +104,12 @@ impl From<crate::blob::BlobError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::message::InvalidMsgId> for Error {
|
||||
fn from(_err: crate::message::InvalidMsgId) -> Error {
|
||||
Error::InvalidMsgId
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! bail {
|
||||
($e:expr) => {
|
||||
|
||||
Reference in New Issue
Block a user