-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use crate::result::Result; | ||
use crate::util::path_to_str; | ||
use md5::compute; | ||
use std::path::Path; | ||
|
||
pub struct HexDigest(String); | ||
|
||
impl HexDigest { | ||
pub fn from_path<P>(config_path: P) -> Result<Self> | ||
where | ||
P: AsRef<Path>, | ||
{ | ||
let digest = compute(path_to_str(config_path.as_ref())?); | ||
let hex_digest = format!("{:x}", digest); | ||
Ok(Self(hex_digest)) | ||
} | ||
|
||
pub fn as_str(&self) -> &str { | ||
&self.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters