pub struct TimeEntry {
pub id: String,
pub duration_minutes: Option<i64>,
pub date: Option<String>,
pub author: String,
pub note: Option<String>,
pub extensions: TimeEntryExtensions,
}Expand description
One current time entry: actual effort recorded against one issue.
The fields are the mission’s confirmed shape (data-model §1, C-002):
id is the stable identity that is never reused, duration_minutes the
effort at documented minute precision, date an optional calendar date,
author the required attribution, note optional free text, and
extensions whatever else the file carries. An entry is
not an estimate, a status or an ownership value, and no operation on one may
change those (C-008).
Eq/Ord are the file’s own notions: equality is field-by-field (with the
extensions compared by canonical render) and ordering is
order_key — dated entries oldest first, undated last,
ties by stable id — with every remaining field compared afterwards so the
order is a total order consistent with equality. Surfaces that display
entries in a deterministic order (data-model §6) sort by that order.
Fields§
§id: StringThe stable id: identity for edits, deletions and History references.
Required for a valid entry and refused when blank, but default’d on
read so an entry a hand edit emptied still parses and is reported
instead of failing the issue (see the module docs).
duration_minutes: Option<i64>The effort, in whole minutes at or above zero.
Option for the same diagnosability reason: a valid entry always
carries one, and an absent one is refused by name rather than read as
zero minutes.
date: Option<String>The calendar date the effort belongs to, YYYY-MM-DD.
Optional and skipped when absent, so an entry without a date round-trips without gaining a key, and so an issue that carries no entry at all is unaffected by this field’s existence.
Who recorded the effort: an identity in the shape an issue’s assignee
tolerates (a bare handle, or Name <email>), verbatim.
note: Option<String>Optional free text, preserved verbatim.
extensions: TimeEntryExtensionsUnknown metadata, preserved verbatim.
Implementations§
Source§impl TimeEntry
impl TimeEntry
Sourcepub fn new(
id: impl Into<String>,
duration_minutes: i64,
date: Option<String>,
author: impl Into<String>,
note: Option<String>,
) -> Result<Self, Vec<TimeEntryError>>
pub fn new( id: impl Into<String>, duration_minutes: i64, date: Option<String>, author: impl Into<String>, note: Option<String>, ) -> Result<Self, Vec<TimeEntryError>>
Build a valid entry, refusing the same values Self::validate refuses.
Returns every problem at once, in field order, rather than the first: a caller fixing an entry should not have to resubmit it once per field.
Sourcepub fn minutes(&self) -> Option<i64>
pub fn minutes(&self) -> Option<i64>
The duration when it is present and at or above zero.
None is exactly the malformed state Self::problems reports, so a
caller that has validated the entry can add this to a total and a caller
that has not cannot mistake a missing duration for zero minutes.
Sourcepub fn order_key(&self) -> (bool, Option<&str>, &str)
pub fn order_key(&self) -> (bool, Option<&str>, &str)
The deterministic display order (data-model §6).
Dated entries oldest first, undated last, ties broken by the stable id.
Comparing the whole tuple is how Ord keeps its order consistent with
equality.
Sourcepub fn problems(&self) -> Vec<TimeEntryError>
pub fn problems(&self) -> Vec<TimeEntryError>
Every field-level problem, in field order; empty means valid.
Sourcepub fn validate(&self) -> Result<(), Vec<TimeEntryError>>
pub fn validate(&self) -> Result<(), Vec<TimeEntryError>>
Refuse the entry unless every field is valid.
Err carries all of Self::problems, not just the first, so a
diagnostic surface can report the complete field set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TimeEntry
impl<'de> Deserialize<'de> for TimeEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TimeEntry
Source§impl Ord for TimeEntry
impl Ord for TimeEntry
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TimeEntry
impl PartialOrd for TimeEntry
impl StructuralPartialEq for TimeEntry
Auto Trait Implementations§
impl Freeze for TimeEntry
impl RefUnwindSafe for TimeEntry
impl Send for TimeEntry
impl Sync for TimeEntry
impl Unpin for TimeEntry
impl UnsafeUnpin for TimeEntry
impl UnwindSafe for TimeEntry
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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