pub struct IdentityMap {
pub groups: Vec<AuthorMergeGroup>,
}Expand description
A persisted collection of AuthorMergeGroups. Applied to a run’s authors at display time.
Fields§
§groups: Vec<AuthorMergeGroup>Implementations§
Source§impl IdentityMap
impl IdentityMap
Sourcepub fn load(path: &Path) -> Self
pub fn load(path: &Path) -> Self
Load from path, returning an empty map if the file is missing or unreadable (so a
fresh install just has no merges).
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Persist to path as pretty JSON.
§Errors
Returns an error if the file cannot be written or serialization fails.
Sourcepub fn group_for(&self, email: &str) -> Option<&AuthorMergeGroup>
pub fn group_for(&self, email: &str) -> Option<&AuthorMergeGroup>
The group containing email (case-insensitive), if any.
Sourcepub fn merge(&mut self, emails: &[String], name: Option<&str>)
pub fn merge(&mut self, emails: &[String], name: Option<&str>)
Merge the given emails into a single identity. Any existing groups that overlap the
selection are absorbed (so merging already-merged contributors just extends the group).
name sets the canonical display name; when None, the first email is used. A merge of
fewer than two distinct emails is a no-op.
Sourcepub fn unmerge(&mut self, canonical_email: &str)
pub fn unmerge(&mut self, canonical_email: &str)
Remove the group whose canonical_email matches (splitting it back into its originals).
Sourcepub fn to_mailmap(&self) -> String
pub fn to_mailmap(&self) -> String
Render the map as a git .mailmap file so the merges round-trip into git itself
(git shortlog, git blame --mailmap, and future oxide-sloc scans all honour it).
Trait Implementations§
Source§impl Clone for IdentityMap
impl Clone for IdentityMap
Source§fn clone(&self) -> IdentityMap
fn clone(&self) -> IdentityMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more