Skip to main content

CapacityCalculation

Struct CapacityCalculation 

Source
pub struct CapacityCalculation {
Show 13 fields pub scope: CapacityScope, pub capacity: Option<u64>, pub unit: Option<String>, pub committed: Option<u64>, pub completed: Option<u64>, pub remaining: Option<u64>, pub overflow: Option<u64>, pub utilization: Option<u32>, pub counted_issues: Option<u32>, pub uncounted_issues: Option<u32>, pub unestimated_issues: Option<u32>, pub source: CapacitySource, pub diagnostics: Vec<CapacityWarning>,
}
Expand description

The shared derived result for one scope (data-model §4, T013).

Every derived field is None exactly when the calculation could not run; see the module docs for the rule. The DTO is read-only by construction: it holds no store, no root and no writer, so the same value that a CLI prints is the one an MCP tool returns and the one portable output serializes (C-007).

Fields§

§scope: CapacityScope

The scope the numbers describe.

§capacity: Option<u64>

The ceiling in force, or None when no capacity entry applies: unconfigured is not a zero ceiling.

§unit: Option<String>

The unit every number is counted in, from the capacity entry. None when the scope is unconfigured — a capacity with no unit cannot be calculated (C-004).

§committed: Option<u64>

The sum of the valid, converted estimates in scope. None when nothing could be counted; Some(0) only when the scope was counted and holds no counted work.

§completed: Option<u64>

The committed part whose issues the shared completion service calls complete (T015). Always <= committed: it is the same per-issue numbers over a subset.

§remaining: Option<u64>

committed - completed. None exactly when those are.

§overflow: Option<u64>

max(committed - capacity, 0). None when either input is unknown; Some(0) at or under the ceiling, because a scope exactly at its ceiling is not over it.

§utilization: Option<u32>

committed as a floored whole percentage of capacity — the one rounding policy (C-007). None when no ceiling is configured or the ceiling is 0, where the ratio has no value; never 0 standing in for “unknown”.

§counted_issues: Option<u32>

Issues whose estimate was counted into committed.

§uncounted_issues: Option<u32>

Issues that state an estimate which could not be counted in the unit; each has a diagnostic naming it. They contribute nothing to the sums.

§unestimated_issues: Option<u32>

Issues that state no estimate at all. Visible, never zero, and never an error — stating nothing is not a mistake (C-005, data-model §3).

§source: CapacitySource

The snapshot the numbers came from.

§diagnostics: Vec<CapacityWarning>

The findings, in derivation order: about the scope itself, then about its members in issue order, then about the total derived from them (T017).

Implementations§

Source§

impl CapacityCalculation

Source

pub fn for_scope( snapshot: &IssueSnapshot, index: &ScheduleIndex, config: &Config, scope: CapacityScope, ) -> Self

Calculate one scope from an already-built snapshot.

index is the ScheduleIndex snapshot was built with (a cycle reference resolves through it), and config is the project configuration that snapshot was built under: the snapshot’s conversion table includes every unit config.capacity declares, and the ceiling and unit come from the entry that targets scope. A reference is matched on the identity super::config::validate keys a ceiling by — never on the text — so @ada for ada and a generated cycle’s stable id for its name are one scope.

Nothing is mutated, and nothing outside the snapshot is read: the issues are already indexed, and this walks the scope’s membership list once, in issue order.

Source

pub fn state(&self) -> CapacityState

Whether this calculation had a ceiling it could count against (T016).

The explicit no-capacity state: a scope with no entry, or with an entry that is not in force, is CapacityState::Unconfigured rather than a scope with zero capacity.

Source

pub fn is_over_capacity(&self) -> bool

Whether the scope is over its ceiling.

The one predicate a surface asks instead of comparing overflow itself, so “over capacity” means one thing everywhere.

Trait Implementations§

Source§

impl Clone for CapacityCalculation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CapacityCalculation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CapacityCalculation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CapacityCalculation

Source§

impl PartialEq for CapacityCalculation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CapacityCalculation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.