1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 23:12:44 +01:00

Add helper function parseHashFormat[Opt] printHashFormat

Add hash format analogy of
parseHashTypeOpt, parseHashType, and printHashType.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
This commit is contained in:
Yueh-Shun Li 2023-10-09 11:03:16 +08:00
parent 231b0fca6d
commit 6b47635180
3 changed files with 65 additions and 0 deletions

View file

@ -181,6 +181,21 @@ HashResult hashPath(HashType ht, const Path & path,
*/
Hash compressHash(const Hash & hash, unsigned int newSize);
/**
* Parse a string representing a hash format.
*/
HashFormat parseHashFormat(std::string_view hashFormatName);
/**
* std::optional version of parseHashFormat that doesn't throw error.
*/
std::optional<HashFormat> parseHashFormatOpt(std::string_view hashFormatName);
/**
* The reverse of parseHashFormat.
*/
std::string_view printHashFormat(HashFormat hashFormat);
/**
* Parse a string representing a hash type.
*/