Refactor package_qualified_imported_modules in load

This commit is contained in:
Agus Zubiaga 2024-04-27 23:01:22 -03:00
parent eea2196c30
commit 9df5fb7092
No known key found for this signature in database
2 changed files with 13 additions and 13 deletions

View file

@ -462,6 +462,15 @@ impl<'a, T> PackageQualified<'a, T> {
PackageQualified::Qualified(_, name) => name,
}
}
pub fn map_module<B>(&self, f: impl FnOnce(&T) -> B) -> PackageQualified<'a, B> {
match self {
PackageQualified::Unqualified(name) => PackageQualified::Unqualified(f(name)),
PackageQualified::Qualified(package, name) => {
PackageQualified::Qualified(package, f(name))
}
}
}
}
#[derive(Debug, Clone)]