pub struct Requirement {Show 32 fields
pub id: Uuid,
pub spec_id: Option<String>,
pub agreed_id: Option<String>,
pub prefix_override: Option<String>,
pub title: String,
pub description: String,
pub status: RequirementStatus,
pub priority: RequirementPriority,
pub owner: String,
pub feature: String,
pub created_at: DateTime<Utc>,
pub created_by: Option<String>,
pub modified_at: DateTime<Utc>,
pub req_type: RequirementType,
pub meta_subtype: Option<MetaSubtype>,
pub dependencies: Vec<Uuid>,
pub tags: HashSet<String>,
pub weight: Option<f32>,
pub relationships: Vec<Relationship>,
pub comments: Vec<Comment>,
pub history: Vec<HistoryEntry>,
pub archived: bool,
pub custom_status: Option<String>,
pub custom_priority: Option<String>,
pub custom_fields: HashMap<String, String>,
pub urls: Vec<UrlLink>,
pub attachments: Vec<Attachment>,
pub trace_links: Vec<TraceLink>,
pub gitlab_issues: Vec<GitLabIssueLink>,
pub implementation_info: Option<ImplementationInfo>,
pub ai_evaluation: Option<StoredAiEvaluation>,
pub version: i64,
}Expand description
Represents a single requirement in the system
Fields§
§id: UuidUnique identifier for the requirement (UUID)
spec_id: Option<String>Human-friendly specification ID (e.g., “SPEC-001”)
agreed_id: Option<String>Short agreed ID assigned at merge-to-trunk (e.g., “FR-423”). Only populated in distributed mode after the merge gate runs. In centralized mode, spec_id is already the short form so this is unused. Both spec_id and agreed_id permanently resolve to the same UUID.
prefix_override: Option<String>Optional prefix override for the spec_id (e.g., “SEC” for security requirements) If set, uses this prefix instead of deriving from feature/type Must be uppercase letters only (A-Z)
title: StringShort title describing the requirement
description: StringDetailed description of the requirement
status: RequirementStatusCurrent status of the requirement
priority: RequirementPriorityPriority level of the requirement
owner: StringPerson responsible for the requirement
feature: StringThe feature this requirement belongs to
created_at: DateTime<Utc>When the requirement was created
created_by: Option<String>Who created this requirement
modified_at: DateTime<Utc>When the requirement was last modified
req_type: RequirementTypeType of the requirement
meta_subtype: Option<MetaSubtype>Subtype for Meta requirements (prompts, skills, commands, etc.)
dependencies: Vec<Uuid>IDs of requirements this requirement depends on
Tags for categorizing the requirement
weight: Option<f32>Weight/effort estimate for the requirement (e.g., story points) Optional - only shown in UI when set
relationships: Vec<Relationship>Relationships to other requirements
comments: Vec<Comment>Comments on this requirement (threaded)
history: Vec<HistoryEntry>History of changes to this requirement
archived: boolWhether this requirement is archived
custom_status: Option<String>Custom status string (for types with custom statuses)
If set, this takes precedence over the status enum field
custom_priority: Option<String>Custom priority string (for types with custom priorities)
If set, this takes precedence over the priority enum field
custom_fields: HashMap<String, String>Custom field values (key = field name, value = field value as string)
urls: Vec<UrlLink>External URL links attached to this requirement
attachments: Vec<Attachment>File attachments on this requirement
trace_links: Vec<TraceLink>Trace links to code artifacts implementing this requirement
gitlab_issues: Vec<GitLabIssueLink>Links to GitLab issues related to this requirement
implementation_info: Option<ImplementationInfo>Implementation metadata for this requirement
ai_evaluation: Option<StoredAiEvaluation>Cached AI evaluation results Automatically populated by background evaluator when requirement changes
version: i64Version number for optimistic locking (SQLite only) Incremented on each update, used to detect concurrent modifications
Implementations§
Source§impl Requirement
impl Requirement
Sourcepub fn new(title: String, description: String) -> Self
pub fn new(title: String, description: String) -> Self
Creates a new requirement with the specified title and description
Sourcepub fn display_id(&self) -> String
pub fn display_id(&self) -> String
Gets the best display ID: agreed_id if available, then spec_id, then UUID.
Sourcepub fn matches_id(&self, id: &str) -> bool
pub fn matches_id(&self, id: &str) -> bool
Check if this requirement matches a given ID string. Matches against spec_id, agreed_id, or UUID.
Sourcepub fn effective_status(&self) -> String
pub fn effective_status(&self) -> String
Gets the effective status string, preferring custom_status if set
Sourcepub fn set_status_from_str(&mut self, status_str: &str)
pub fn set_status_from_str(&mut self, status_str: &str)
Sets the status from a string, using custom_status for non-standard values
Sourcepub fn effective_priority(&self) -> String
pub fn effective_priority(&self) -> String
Gets the effective priority string, preferring custom_priority if set
Sourcepub fn set_priority_from_str(&mut self, priority_str: &str)
pub fn set_priority_from_str(&mut self, priority_str: &str)
Sets the priority from a string, using custom_priority for non-standard values
Sourcepub fn get_custom_field(&self, name: &str) -> Option<&String>
pub fn get_custom_field(&self, name: &str) -> Option<&String>
Gets a custom field value
Sourcepub fn set_custom_field(
&mut self,
name: impl Into<String>,
value: impl Into<String>,
)
pub fn set_custom_field( &mut self, name: impl Into<String>, value: impl Into<String>, )
Sets a custom field value
Sourcepub fn remove_custom_field(&mut self, name: &str) -> Option<String>
pub fn remove_custom_field(&mut self, name: &str) -> Option<String>
Removes a custom field
Sourcepub fn validate_prefix(prefix: &str) -> Option<String>
pub fn validate_prefix(prefix: &str) -> Option<String>
Validates and normalizes a prefix string Returns Some(normalized_prefix) if valid, None if invalid Valid prefixes contain only uppercase letters A-Z
Sourcepub fn set_prefix_override(&mut self, prefix: &str) -> Result<(), String>
pub fn set_prefix_override(&mut self, prefix: &str) -> Result<(), String>
Sets the prefix override with validation Returns Ok if valid or empty, Err with message if invalid
Sourcepub fn record_change(&mut self, author: String, changes: Vec<FieldChange>)
pub fn record_change(&mut self, author: String, changes: Vec<FieldChange>)
Records a change to the requirement history
Sourcepub fn field_change(
field_name: &str,
old_value: String,
new_value: String,
) -> FieldChange
pub fn field_change( field_name: &str, old_value: String, new_value: String, ) -> FieldChange
Helper to create a field change
Sourcepub fn add_comment(&mut self, comment: Comment)
pub fn add_comment(&mut self, comment: Comment)
Adds a top-level comment to this requirement
Sourcepub fn add_reply(&mut self, parent_id: Uuid, reply: Comment) -> Result<()>
pub fn add_reply(&mut self, parent_id: Uuid, reply: Comment) -> Result<()>
Adds a reply to an existing comment
Sourcepub fn find_comment_mut(&mut self, comment_id: &Uuid) -> Option<&mut Comment>
pub fn find_comment_mut(&mut self, comment_id: &Uuid) -> Option<&mut Comment>
Finds a comment by ID (returns mutable reference)
Sourcepub fn delete_comment(&mut self, comment_id: &Uuid) -> Result<()>
pub fn delete_comment(&mut self, comment_id: &Uuid) -> Result<()>
Deletes a comment by ID
Sourcepub fn content_hash(&self) -> String
pub fn content_hash(&self) -> String
Compute a hash of the requirement content used for AI evaluation staleness detection The hash includes title, description, and type - fields that affect evaluation
Sourcepub fn needs_ai_evaluation(&self) -> bool
pub fn needs_ai_evaluation(&self) -> bool
Check if AI evaluation is needed (never evaluated or stale)
Trait Implementations§
Source§impl Clone for Requirement
impl Clone for Requirement
Source§fn clone(&self) -> Requirement
fn clone(&self) -> Requirement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Requirement
impl Debug for Requirement
Source§impl<'de> Deserialize<'de> for Requirement
impl<'de> Deserialize<'de> for Requirement
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 Serialize for Requirement
impl Serialize for Requirement
Source§impl TS for Requirement
impl TS for Requirement
Source§type WithoutGenerics = Requirement
type WithoutGenerics = Requirement
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or ().
The only requirement for these dummy types is that EXPORT_TO must be None. Read moreSource§type OptionInnerType = Requirement
type OptionInnerType = Requirement
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete() -> String
fn decl_concrete() -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl() -> String
fn decl() -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline() -> String
fn inline() -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened() -> String
fn inline_flattened() -> String
This function will panic if the type cannot be flattened.
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported.The returned path does not include the base directory from
TS_RS_EXPORT_DIR. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies() -> Vec<Dependency>where
Self: 'static,
fn dependencies() -> Vec<Dependency>where
Self: 'static,
Source§fn export() -> Result<(), ExportError>where
Self: 'static,
fn export() -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all() -> Result<(), ExportError>where
Self: 'static,
fn export_all() -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export. Read moreSource§fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export. Read more