pub enum DocumentState {
Draft,
Review,
Frozen,
Published,
}Expand description
Document lifecycle state.
Documents progress through states that determine what operations are allowed and what integrity guarantees are enforced.
Variants§
Draft
Active editing state.
- Content can be freely modified
- Document ID may be “pending”
- No signatures required
Review
Review/approval state.
- Content can still be modified
- Document ID should be computed
- Signatures optional
Frozen
Immutable state.
- Content cannot be modified
- Document ID must be computed and valid
- At least one signature required
- Lineage required (parent required only if forked)
Published
Distribution state.
- Same immutability as frozen
- Indicates document is ready for public distribution
- At least one signature required
- Lineage required (parent required only if forked)
Implementations§
Source§impl DocumentState
impl DocumentState
Sourcepub const fn is_editable(&self) -> bool
pub const fn is_editable(&self) -> bool
Returns whether the document content can be modified in this state.
Sourcepub const fn is_immutable(&self) -> bool
pub const fn is_immutable(&self) -> bool
Returns whether the document is immutable in this state.
Sourcepub const fn requires_signature(&self) -> bool
pub const fn requires_signature(&self) -> bool
Returns whether signatures are required in this state.
Sourcepub const fn requires_lineage(&self) -> bool
pub const fn requires_lineage(&self) -> bool
Returns whether lineage may be required in this state.
Per spec, lineage is mandatory for forked documents (those with a parent) in Frozen/Published states. Root documents can transition to these states without lineage. This method indicates the state where lineage requirements apply; actual enforcement depends on whether the document is forked.
Sourcepub const fn requires_computed_id(&self) -> bool
pub const fn requires_computed_id(&self) -> bool
Returns whether the document ID must be computed (not “pending”).
Sourcepub const fn requires_precise_layout(&self) -> bool
pub const fn requires_precise_layout(&self) -> bool
Returns whether a precise layout is required in this state.
Frozen and published documents require at least one precise layout to ensure exact visual reproduction as part of the immutable record.
Sourcepub const fn can_transition_to(&self, target: Self) -> bool
pub const fn can_transition_to(&self, target: Self) -> bool
Check if transitioning to the target state is valid.
Sourcepub const fn valid_transitions(&self) -> &'static [DocumentState]
pub const fn valid_transitions(&self) -> &'static [DocumentState]
Get all valid target states from the current state.
Trait Implementations§
Source§impl Clone for DocumentState
impl Clone for DocumentState
Source§fn clone(&self) -> DocumentState
fn clone(&self) -> DocumentState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DocumentState
impl Debug for DocumentState
Source§impl<'de> Deserialize<'de> for DocumentState
impl<'de> Deserialize<'de> for DocumentState
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>,
Source§impl Display for DocumentState
impl Display for DocumentState
Source§impl FromStr for DocumentState
impl FromStr for DocumentState
Source§impl Hash for DocumentState
impl Hash for DocumentState
Source§impl PartialEq for DocumentState
impl PartialEq for DocumentState
Source§impl Serialize for DocumentState
impl Serialize for DocumentState
impl Copy for DocumentState
impl Eq for DocumentState
impl StructuralPartialEq for DocumentState
Auto Trait Implementations§
impl Freeze for DocumentState
impl RefUnwindSafe for DocumentState
impl Send for DocumentState
impl Sync for DocumentState
impl Unpin for DocumentState
impl UnsafeUnpin for DocumentState
impl UnwindSafe for DocumentState
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> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.