pub trait Document {
Show 22 methods
// Required methods
fn document_type(&self) -> DocumentType;
fn title(&self) -> &str;
fn metadata(&self) -> &DocumentMetadata;
fn content(&self) -> &DocumentContent;
fn core(&self) -> &DocumentCore;
fn can_transition_to(&self, phase: Phase) -> bool;
fn transition_phase(
&mut self,
target_phase: Option<Phase>,
) -> Result<Phase, DocumentValidationError>;
fn core_mut(&mut self) -> &mut DocumentCore;
fn parent_id(&self) -> Option<&DocumentId>;
fn blocked_by(&self) -> &[DocumentId];
fn validate(&self) -> Result<(), DocumentValidationError>;
fn exit_criteria_met(&self) -> bool;
fn template(&self) -> DocumentTemplate;
fn frontmatter_template(&self) -> &'static str;
fn content_template(&self) -> &'static str;
fn acceptance_criteria_template(&self) -> &'static str;
// Provided methods
fn id(&self) -> DocumentId { ... }
fn tags(&self) -> &[Tag] { ... }
fn phase(&self) -> Result<Phase, DocumentValidationError> { ... }
fn update_section(
&mut self,
content: &str,
heading: &str,
append: bool,
) -> Result<(), DocumentValidationError> { ... }
fn update_content_body(
&mut self,
new_body: String,
) -> Result<(), DocumentValidationError> { ... }
fn archived(&self) -> bool { ... }
}
Expand description
Core document trait that all document types must implement
Required Methods§
Sourcefn document_type(&self) -> DocumentType
fn document_type(&self) -> DocumentType
Get the document type
Sourcefn metadata(&self) -> &DocumentMetadata
fn metadata(&self) -> &DocumentMetadata
Get the document metadata
Sourcefn content(&self) -> &DocumentContent
fn content(&self) -> &DocumentContent
Get the document content
Sourcefn core(&self) -> &DocumentCore
fn core(&self) -> &DocumentCore
Get access to the core document data
Sourcefn can_transition_to(&self, phase: Phase) -> bool
fn can_transition_to(&self, phase: Phase) -> bool
Check if this document can transition to the given phase
Sourcefn transition_phase(
&mut self,
target_phase: Option<Phase>,
) -> Result<Phase, DocumentValidationError>
fn transition_phase( &mut self, target_phase: Option<Phase>, ) -> Result<Phase, DocumentValidationError>
Transition to the next phase in sequence, or to a specific phase if provided
Sourcefn core_mut(&mut self) -> &mut DocumentCore
fn core_mut(&mut self) -> &mut DocumentCore
Get mutable access to the document core (needed for updates)
Sourcefn parent_id(&self) -> Option<&DocumentId>
fn parent_id(&self) -> Option<&DocumentId>
Get the parent document ID if this document has a parent
Sourcefn blocked_by(&self) -> &[DocumentId]
fn blocked_by(&self) -> &[DocumentId]
Get IDs of documents that block this one
Sourcefn validate(&self) -> Result<(), DocumentValidationError>
fn validate(&self) -> Result<(), DocumentValidationError>
Validate the document according to its type-specific rules
Sourcefn exit_criteria_met(&self) -> bool
fn exit_criteria_met(&self) -> bool
Check if exit criteria are met
Sourcefn template(&self) -> DocumentTemplate
fn template(&self) -> DocumentTemplate
Get the template for rendering this document type
Sourcefn frontmatter_template(&self) -> &'static str
fn frontmatter_template(&self) -> &'static str
Get the frontmatter template for this document type
Sourcefn content_template(&self) -> &'static str
fn content_template(&self) -> &'static str
Get the content template for this document type
Sourcefn acceptance_criteria_template(&self) -> &'static str
fn acceptance_criteria_template(&self) -> &'static str
Get the acceptance criteria template for this document type
Provided Methods§
Sourcefn id(&self) -> DocumentId
fn id(&self) -> DocumentId
Get the unique identifier for this document (derived from title)
Get the document tags
Sourcefn phase(&self) -> Result<Phase, DocumentValidationError>
fn phase(&self) -> Result<Phase, DocumentValidationError>
Get the current phase of the document (parsed from tags)
Sourcefn update_section(
&mut self,
content: &str,
heading: &str,
append: bool,
) -> Result<(), DocumentValidationError>
fn update_section( &mut self, content: &str, heading: &str, append: bool, ) -> Result<(), DocumentValidationError>
Update a specific section (H2 heading) in the document content
Sourcefn update_content_body(
&mut self,
new_body: String,
) -> Result<(), DocumentValidationError>
fn update_content_body( &mut self, new_body: String, ) -> Result<(), DocumentValidationError>
Helper method for update_section to actually mutate the content