Skip to content

Commit

Permalink
Move UnknownAlgorithmError to lib.rs.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPaddon committed Jun 9, 2024
1 parent b641b79 commit adb30d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/hash/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
//! Cryptographic hashes.
use std::io::Write;
use derive_more::{Constructor, Display, Error};

#[derive(Clone, Constructor, Debug, Display, Error)]
#[display(fmt = "{}: unknown algorithm", name)]
pub struct UnknownAlgorithmError {
name: String
}
use crate::UnknownAlgorithmError;

/// A cryptographic hash algorithm.
pub trait Hash: Write {
Expand Down
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
//! Scytale (pronounced /ˈskɪtəliː/) is a **fast** and **correct**
//! cryptographic library.
use derive_more::{Constructor, Display, Error};

#[derive(Clone, Constructor, Debug, Display, Error)]
#[display(fmt = "{}: unknown algorithm", name)]
pub struct UnknownAlgorithmError {
name: String
}

pub mod hash;
pub mod mac;
pub(crate) mod util;
2 changes: 1 addition & 1 deletion src/mac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use std::io::Write;
use crate::hash::sha2::{Sha224, Sha256, Sha384, Sha512, Sha512_224, Sha512_256};
use crate::mac::hmac::Hmac;
use crate::hash::UnknownAlgorithmError;
use crate::UnknownAlgorithmError;

/// A Message Authentication Code algorithm.
pub trait Mac: Write {
Expand Down

0 comments on commit adb30d5

Please sign in to comment.