Module image_hash

Source
Expand description

Efficient parsing and storage of Discord image hashes.

In a simple implementation, Discord image hashes are stored in a std::string::String. Using an ImageHash, only 17 bytes are required to store a Discord hash.

ImageHash::parse is used to parse provided bytes, along with std::convert::TryFrom, std::str::FromStr, and serde implementations. The input is assumed to be only in ASCII format. ImageHash::bytes and ImageHash::is_animated may be used to deconstruct the hash and ImageHash::new may be used to reconstruct one.

Structs§

ImageHash
Efficient storage for Discord image hashes.
ImageHashParseError
Parsing an image hash into an efficient storage format via ImageHash::parse failed.
Nibbles
Iterator over the nibbles of an image hash.

Enums§

ImageHashParseErrorType
Type of ImageHashParseError that occurred.