pub struct Action {
pub from_state: Option<StateId>,
pub to_state: StateId,
pub operation: Operation,
pub description: String,
pub semantic_changes: Vec<SemanticChange>,
pub attribution: Attribution,
pub timestamp: DateTime<Utc>,
/* private fields */
}Expand description
An action records an operation between states.
Fields§
§from_state: Option<StateId>Source state (None for initial state).
to_state: StateIdDestination state.
operation: OperationType of operation.
description: StringHuman-readable description.
semantic_changes: Vec<SemanticChange>High-level semantic changes.
attribution: AttributionWho performed the action.
timestamp: DateTime<Utc>When the action was performed.
Implementations§
Source§impl Action
impl Action
Sourcepub fn new(
from_state: Option<StateId>,
to_state: StateId,
operation: Operation,
description: impl Into<String>,
attribution: Attribution,
) -> Action
pub fn new( from_state: Option<StateId>, to_state: StateId, operation: Operation, description: impl Into<String>, attribution: Attribution, ) -> Action
Create a new action.
Sourcepub fn with_semantic_changes(self, changes: Vec<SemanticChange>) -> Action
pub fn with_semantic_changes(self, changes: Vec<SemanticChange>) -> Action
Add semantic changes.
Sourcepub fn add_semantic_change(&mut self, change: SemanticChange)
pub fn add_semantic_change(&mut self, change: SemanticChange)
Add a single semantic change.
Sourcepub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Action
pub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Action
Set the timestamp (for testing or importing).
Sourcepub fn compute_id(&self) -> ActionId
pub fn compute_id(&self) -> ActionId
Compute the action ID from content.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Action, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Action, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Action
impl Serialize for Action
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
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
Mutably borrows from an owned value. Read more