pub struct TaskId(/* private fields */);Expand description
A unit of intended work that a person opens and closes: t-<YYYYMMDDHHMMSS>-<4 hex>.
An super::Episode carries Option<TaskId> and nothing else of a task. The
separation is ADR 0052’s whole finding: a task is optional, is opened and closed by a
person, and outlives or predeceases any number of episodes. What made this repository
write no checkpoint and no handover for six days was code that asked a task whether an
episode’s artefact should be written.
use majordomus_cli::session::{EpisodeId, TaskId};
let t = TaskId::parse("t-20260905034523-a9f1").expect("the task from the audit");
assert_eq!(t.as_str(), "t-20260905034523-a9f1");
// the shapes rhyme and the types do not: an episode id is not a task id
assert!(TaskId::parse("s-20260910205542-e2a6").is_none());
assert!(EpisodeId::parse("t-20260905034523-a9f1").is_none());Implementations§
Source§impl TaskId
impl TaskId
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
Parse an id as lib/start.sh writes it. None for anything else, including the
literal none the records use for “no task”, which is an absence and is
represented as Option::None rather than as a task whose name is a word.
use majordomus_cli::session::TaskId;
assert!(TaskId::parse("t-20260905034523-a9f1").is_some());
assert!(TaskId::parse("none").is_none(), "the records' word for no task");Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
The id as text: what a record writes as task_id:. An episode relates to a task by
this value and holds nothing else of one.
use majordomus_cli::session::TaskId;
let t = TaskId::parse("t-20260905034523-a9f1").expect("a task id");
assert_eq!(t.as_str(), "t-20260905034523-a9f1");Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskId
impl<'de> Deserialize<'de> for TaskId
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 TaskId
Source§impl JsonSchema for TaskId
impl JsonSchema for TaskId
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for TaskId
impl Ord for TaskId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TaskId
impl PartialOrd for TaskId
impl StructuralPartialEq for TaskId
Auto Trait Implementations§
impl Freeze for TaskId
impl RefUnwindSafe for TaskId
impl Send for TaskId
impl Sync for TaskId
impl Unpin for TaskId
impl UnsafeUnpin for TaskId
impl UnwindSafe for TaskId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.