intermodal/bin/gen/src/kind.rs
Casey Rodarmor 4e6b475470
Benchmark and improve hashing performance
- Add a `bench` feature that exposes a hasher benchmark.

- Make the hasher read up to the next piece end and hash everything it
  reads, instead of hashing one byte at a time. This was a 4x
  improvement on the benchmark. (Terrible code == easy wins!)

type: performance
2020-05-26 00:15:09 -07:00

71 lines
1.5 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use crate::common::*;
#[derive(
Deserialize,
Serialize,
Debug,
Clone,
Copy,
Eq,
PartialEq,
Ord,
PartialOrd,
IntoStaticStr,
EnumVariantNames,
)]
#[serde(rename_all = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub(crate) enum Kind {
Added,
Breaking,
Changed,
Dependencies,
Development,
Distribution,
Documentation,
Fixed,
Performance,
Reform,
Release,
Removed,
Testing,
}
impl Kind {
pub(crate) fn emoji_character(self) -> &'static str {
match self {
Self::Added => "",
Self::Breaking => "💥",
Self::Changed => "⚡️",
Self::Dependencies => "⬆️",
Self::Development => "🔧",
Self::Distribution => "📦",
Self::Documentation => "📚",
Self::Fixed => "🐛",
Self::Performance => "🐎",
Self::Reform => "🎨",
Self::Release => "🔖",
Self::Removed => "",
Self::Testing => "",
}
}
pub(crate) fn emoji_name(self) -> &'static str {
match self {
Self::Added => ":sparkles:",
Self::Breaking => ":boom:",
Self::Changed => ":zap:",
Self::Dependencies => ":arrow_up:",
Self::Development => ":wrench:",
Self::Distribution => ":package:",
Self::Documentation => ":books:",
Self::Fixed => ":bug:",
Self::Performance => ":racehorse:",
Self::Reform => ":art:",
Self::Release => ":bookmark:",
Self::Removed => ":heavy_minus_sign:",
Self::Testing => ":white_check_mark:",
}
}
}