nandi/rustnimpublic Fork 0
99b837678a29fedd20bb68a5117a6621d8d178b4
Commits
Clone
git clone https://git.rickub.com/nandi/rustnim.git
git clone ssh://git@rickub.com/nandi/rustnim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

error.rs · 31 lines · 762 BRust Blame HistoryRaw
Add trait impls and slice iterators; base16ct's decoder now goes through ae9f986 nandithebull 19h ago1use core::fmt;
2
3/// Result type with the `base16ct` crate's [`Error`] type.
4pub type Result<T> = core::result::Result<T, Error>;
5
6/// Error type
7#[derive(Clone, Eq, PartialEq, Debug)]
8pub enum Error {
9 /// Invalid encoding of provided Base16 string.
10 InvalidEncoding,
11
12 /// Insufficient output buffer length.
13 InvalidLength,
14}
15
16impl fmt::Display for Error {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 Error::InvalidEncoding => f.write_str("invalid Base16 encoding"),
20 Error::InvalidLength => f.write_str("invalid Base16 length"),
21 }
22 }
23}
24
25impl core::error::Error for Error {}
26
27impl From<Error> for fmt::Error {
28 fn from(_: Error) -> fmt::Error {
29 fmt::Error
30 }
31}