pub struct Activity { /* private fields */ }Expand description
A production operation connecting input and output representations.
Implementations§
Source§impl Activity
impl Activity
Sourcepub fn new(
id: ActivityId,
kind: ActivityKind,
inputs: Vec<ActivityInput>,
outputs: Vec<ActivityOutput>,
) -> Result<Self>
pub fn new( id: ActivityId, kind: ActivityKind, inputs: Vec<ActivityInput>, outputs: Vec<ActivityOutput>, ) -> Result<Self>
Creates a complete production activity and canonicalizes its edges.
An activity may have no inputs, but must produce at least one output because this model does not expose an in-progress lifecycle state.
§Errors
Returns ErrorKind::InvalidArgument when edges are empty or
excessive, an identical edge is duplicated, or one representation
appears on both sides of the activity.
Sourcepub fn with_timing(
self,
started_at: Option<Timestamp>,
finished_at: Option<Timestamp>,
) -> Result<Self>
pub fn with_timing( self, started_at: Option<Timestamp>, finished_at: Option<Timestamp>, ) -> Result<Self>
Adds optional activity timing.
§Errors
Returns ErrorKind::InvalidArgument when both times are present and
the finish precedes the start.
Sourcepub fn with_tool(self, tool: ToolIdentity) -> Self
pub fn with_tool(self, tool: ToolIdentity) -> Self
Adds the optional tool that performed the activity.
Sourcepub fn with_agent(self, agent: AgentIdentity) -> Self
pub fn with_agent(self, agent: AgentIdentity) -> Self
Adds the optional agent responsible for the activity.
Sourcepub const fn id(&self) -> ActivityId
pub const fn id(&self) -> ActivityId
Returns the activity’s stable identity.
Sourcepub const fn kind(&self) -> &ActivityKind
pub const fn kind(&self) -> &ActivityKind
Returns the extensible activity kind.
Sourcepub const fn started_at(&self) -> Option<Timestamp>
pub const fn started_at(&self) -> Option<Timestamp>
Returns the optional start time.
Sourcepub const fn finished_at(&self) -> Option<Timestamp>
pub const fn finished_at(&self) -> Option<Timestamp>
Returns the optional finish time.
Sourcepub const fn tool(&self) -> Option<&ToolIdentity>
pub const fn tool(&self) -> Option<&ToolIdentity>
Returns the optional responsible tool.
Sourcepub const fn agent(&self) -> Option<&AgentIdentity>
pub const fn agent(&self) -> Option<&AgentIdentity>
Returns the optional responsible agent.
Sourcepub fn inputs(&self) -> &[ActivityInput]
pub fn inputs(&self) -> &[ActivityInput]
Returns inputs in canonical representation/role order.
Sourcepub fn outputs(&self) -> &[ActivityOutput]
pub fn outputs(&self) -> &[ActivityOutput]
Returns outputs in canonical representation/role order.