Skip to main content

diff_repos

Function diff_repos 

Source
pub fn diff_repos(a: &Repo, b: &Repo) -> RepoDiff
Expand description

Compare two Repo values and produce a RepoDiff.

Compares the following fields: name, baseurl, enabled, gpgcheck, priority, and gpgkey. Fields that are None in both directions are considered absent; fields that change from Some to None or vice versa are reported as removed or added respectively.

ยงExamples

use dnf_repofile::{Repo, RepoId, diff_repos};

let mut a = Repo::new(RepoId::try_new("repo").unwrap());
a.name = Some(dnf_repofile::RepoName::try_new("Old Name").unwrap());

let mut b = Repo::new(RepoId::try_new("repo").unwrap());
b.name = Some(dnf_repofile::RepoName::try_new("New Name").unwrap());

let diff = diff_repos(&a, &b);
assert!(diff.has_changes);