pub struct ProjectModel {
pub units: Vec<Unit>,
/* private fields */
}Expand description
The repo’s discovered .csproj projects, their direct references, and
the transitive closure over those references.
Fields§
§units: Vec<Unit>All discovered units, sorted by id. A unit’s position in this
vector is its index everywhere else in this type (dir_to_unit
values, closure entries, reachable’s arguments).
Implementations§
Source§impl ProjectModel
impl ProjectModel
Sourcepub fn from_units(units: Vec<Unit>) -> Self
pub fn from_units(units: Vec<Unit>) -> Self
Builds a ProjectModel from an already-scanned unit list: sorts
units by id, maps each directory that owns exactly one unit to
it, and computes each unit’s transitive reference closure by BFS.
This is the constructor discover itself uses once scanning is done,
and the one a persistence layer would use to rebuild a ProjectModel
from a stored unit list without re-scanning any files.
Sourcepub fn unit_of_file(&self, rel: &str) -> Option<usize>
pub fn unit_of_file(&self, rel: &str) -> Option<usize>
The unit owning rel (a repo-relative file path, /-joined): the
nearest ancestor directory of rel that owns EXACTLY one unit.
A directory owning zero units is walked past because nothing maps
it; a directory owning two or more is ALSO walked past, on purpose
(ProjectModel::from_units never maps an ambiguous directory) –
climbing to the next single-project ancestor instead of guessing
which of the colliding projects owns the file. None when no
ancestor, up to and including the repo root, owns exactly one unit.
Trait Implementations§
Source§impl Clone for ProjectModel
impl Clone for ProjectModel
Auto Trait Implementations§
impl Freeze for ProjectModel
impl RefUnwindSafe for ProjectModel
impl Send for ProjectModel
impl Sync for ProjectModel
impl Unpin for ProjectModel
impl UnsafeUnpin for ProjectModel
impl UnwindSafe for ProjectModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more