git_cliff_core/contributor.rs
1use std::hash::{Hash, Hasher};
2
3use serde::{Deserialize, Serialize};
4
5/// Representation of a remote contributor.
6#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)]
7pub struct RemoteContributor {
8 /// Username.
9 pub username: Option<String>,
10 /// Account that opened the pull request.
11 ///
12 /// Unlike `username`, this is not resolved from the commit author. Only set
13 /// per commit; contributor entries leave it empty because they are
14 /// deduplicated by `username`.
15 pub pr_author: Option<String>,
16 /// Title of the pull request.
17 pub pr_title: Option<String>,
18 /// The pull request that the user created.
19 pub pr_number: Option<i64>,
20 /// All pull requests that the user created in this release, sorted in
21 /// ascending order (lowest PR number first).
22 #[serde(default)]
23 pub pr_numbers: Vec<i64>,
24 /// Labels of the pull request.
25 pub pr_labels: Vec<String>,
26 /// Whether if the user contributed for the first time.
27 pub is_first_time: bool,
28}
29
30impl Hash for RemoteContributor {
31 fn hash<H: Hasher>(&self, state: &mut H) {
32 self.username.hash(state);
33 }
34}