pub struct Snapshot { /* private fields */ }
Expand description

A data-structure to efficiently store a list of entries for optimal, case-insensitive lookup by email and optionally name to find mappings to new names and/or emails.

The memory layout is efficient, even though lots of small allocations are performed to store strings of emails and names.

Implementations

Create a new snapshot from the given bytes buffer, ignoring all parse errors that may occur on a line-by-line basis.

This is similar to what git does.

Create a new instance from entries.

These can be obtained using crate::parse().

Merge the given entries into this instance, possibly overwriting existing mappings with new ones should they collide.

Transform our acceleration structure into a list of entries.

Note that the order is different from how they were obtained initially, and are explicitly ordered by (old_email, old_name).

Try to resolve signature by its contained email and name and provide resolved/mapped names as reference. Return None if no such mapping was found.

Note that opposed to what git seems to do, we also normalize the case of email addresses to match the one given in the mailmap. That is, if Alex@example.com is the current email, it will be matched and replaced with alex@example.com. This leads to better mapping results and saves entries in the mailmap.

This is the fastest possible lookup as there is no allocation.

Try to resolve signature by its contained email and name and provide resolved/mapped names as owned signature, with the mapped name and/or email replaced accordingly.

Return None if no such mapping was found.

Like try_resolve(), but always returns an owned signature, which might be a copy of signature if no mapping was found.

Note that this method will always allocate.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.