pub struct Catalog { /* private fields */ }Expand description
Resolves project names by their shortest unambiguous path suffix.
use workyard_core::projects::{Catalog, ProjectLocation};
use std::path::Path;
let a = ProjectLocation { identity: "repo-a".into(), path: "/product-a/api".into() };
let b = ProjectLocation { identity: "repo-b".into(), path: "/product-b/api".into() };
let catalog = Catalog::new(vec![a, b]);
assert!(catalog.resolve(Path::new("api")).is_err());
assert_eq!(catalog.resolve(Path::new("product-b/api")).unwrap().identity, "repo-b");Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn new(locations: Vec<ProjectLocation>) -> Self
pub fn new(locations: Vec<ProjectLocation>) -> Self
Group repository aliases by identity and index their path suffixes.
Sourcepub fn projects(&self) -> impl Iterator<Item = &Project>
pub fn projects(&self) -> impl Iterator<Item = &Project>
Return the projects available for selection.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Catalog
impl Freeze for Catalog
impl Move for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more