pub struct ProjectIndex { /* private fields */ }Expand description
The derived project view over one snapshot of issues and the registry.
Built once and read many times. The bucket map is the NFR-001 index; the
project map is IndexMap so declaration order is the display order; the
label/status maps carry what a member listing needs. Nothing here is stored.
Implementations§
Source§impl ProjectIndex
impl ProjectIndex
Sourcepub fn build<N: ProjectNode>(config: &Config, issues: &[N]) -> Self
pub fn build<N: ProjectNode>(config: &Config, issues: &[N]) -> Self
Build the index in one pass over the issue set.
An association whose project does not resolve is kept in Self::missing
rather than dropped: a silently absent reference is the failure C-005
forbids, and validate_references reports exactly this set.
Sourcepub fn buckets(&self) -> &HashMap<ProjectId, Vec<IssueKey>>
pub fn buckets(&self) -> &HashMap<ProjectId, Vec<IssueKey>>
The reverse index, as the contract spells it.
Sourcepub fn bucket(&self, id: &ProjectId) -> Option<&[IssueKey]>
pub fn bucket(&self, id: &ProjectId) -> Option<&[IssueKey]>
The member keys of one project.
None only for a project the registry does not hold. A known project
with no members returns an empty slice, so “not a project” and “a project
with no members yet” stay distinguishable to a caller.
Sourcepub fn status_of(&self, key: IssueKey) -> Option<&str>
pub fn status_of(&self, key: IssueKey) -> Option<&str>
An issue’s status, as the index recorded it.
Sourcepub fn missing(&self) -> &[MissingProjectReference]
pub fn missing(&self) -> &[MissingProjectReference]
The diagnosed associations of this snapshot.
Sourcepub fn resolve(&self, reference: &str) -> Result<&Project, ProjectError>
pub fn resolve(&self, reference: &str) -> Result<&Project, ProjectError>
Resolve a project by id (first) or by name.
Sourcepub fn membership(
&self,
reference: &str,
) -> Result<ProjectMembership, ProjectError>
pub fn membership( &self, reference: &str, ) -> Result<ProjectMembership, ProjectError>
The ordered membership of a project.
Sourcepub fn resolved_memberships(&self) -> HashMap<u32, Vec<String>>
pub fn resolved_memberships(&self) -> HashMap<u32, Vec<String>>
Every issue’s resolved project ids, in registry declaration order.
The reverse of Self::buckets: issue number -> the ids of the projects
that hold it. Derived from the same buckets, so a grouping surface cannot
disagree with Self::membership about who is a member; an association the
registry does not hold appears in no bucket and therefore in no entry here
(it is diagnosed by validate_references instead — the chosen asymmetry
tix search’s project_matches documents).
Declaration order is the display order, so project_bucket_label over an
entry is the same label the board’s ProjectPartition produces.
Sourcepub fn into_buckets(self) -> HashMap<ProjectId, Vec<IssueKey>>
pub fn into_buckets(self) -> HashMap<ProjectId, Vec<IssueKey>>
Consume the index into its reverse map (the contract’s return shape).
Sourcepub fn into_missing(self) -> Vec<MissingProjectReference>
pub fn into_missing(self) -> Vec<MissingProjectReference>
Consume the index into its missing-reference list.
Sourcepub fn into_projects(self) -> Vec<Project>
pub fn into_projects(self) -> Vec<Project>
Consume the index into its declaration-ordered project list.
Source§impl ProjectIndex
impl ProjectIndex
Sourcepub fn health<S: BuildHasher>(
&self,
config: &Config,
reference: &str,
assigned: &HashSet<u32, S>,
overdue: &HashSet<u32, S>,
blocked: &HashSet<u32, S>,
) -> Result<ProjectHealthReport, ProjectError>
pub fn health<S: BuildHasher>( &self, config: &Config, reference: &str, assigned: &HashSet<u32, S>, overdue: &HashSet<u32, S>, blocked: &HashSet<u32, S>, ) -> Result<ProjectHealthReport, ProjectError>
Progress and health for one project (contract §1, FR-003).
Reads the members from the index’s bucket, so a project’s figures are a bucket lookup rather than a scan of the issue set (contract §4).
assigned, overdue, and blocked are the consumed derived facts,
keyed by issue number and each produced by its owner: assigned_keys, the
planning overdue read, and the relationship graph’s blocked_state. Project
health counts them and never recomputes them. Completion resolves through the
board’s configured completion column via the service resolution, never a
literal "done".
A done issue is never counted as overdue, matching the planner’s own overdue rule: the passed set is normally already filtered, and the guard keeps the invariant true for any caller that passes a raw set.
Trait Implementations§
Source§impl Clone for ProjectIndex
impl Clone for ProjectIndex
Source§impl Debug for ProjectIndex
impl Debug for ProjectIndex
impl Eq for ProjectIndex
Source§impl PartialEq for ProjectIndex
impl PartialEq for ProjectIndex
impl StructuralPartialEq for ProjectIndex
Auto Trait Implementations§
impl Freeze for ProjectIndex
impl RefUnwindSafe for ProjectIndex
impl Send for ProjectIndex
impl Sync for ProjectIndex
impl Unpin for ProjectIndex
impl UnsafeUnpin for ProjectIndex
impl UnwindSafe for ProjectIndex
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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