pub struct Action {
pub from_state: Option<ChangeId>,
pub to_state: ChangeId,
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<ChangeId>Source state (None for initial state).
to_state: ChangeIdDestination 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<ChangeId>,
to_state: ChangeId,
operation: Operation,
description: impl Into<String>,
attribution: Attribution,
) -> Self
pub fn new( from_state: Option<ChangeId>, to_state: ChangeId, operation: Operation, description: impl Into<String>, attribution: Attribution, ) -> Self
Create a new action.
Sourcepub fn with_semantic_changes(self, changes: Vec<SemanticChange>) -> Self
pub fn with_semantic_changes(self, changes: Vec<SemanticChange>) -> Self
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>) -> Self
pub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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