Skip to main content

Requirement

Struct Requirement 

Source
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: Uuid

Unique 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: String

Short title describing the requirement

§description: String

Detailed description of the requirement

§status: RequirementStatus

Current status of the requirement

§priority: RequirementPriority

Priority level of the requirement

§owner: String

Person responsible for the requirement

§feature: String

The 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: RequirementType

Type 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: HashSet<String>

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: bool

Whether 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: i64

Version number for optimistic locking (SQLite only) Incremented on each update, used to detect concurrent modifications

Implementations§

Source§

impl Requirement

Source

pub fn new(title: String, description: String) -> Self

Creates a new requirement with the specified title and description

Source

pub fn display_id(&self) -> String

Gets the best display ID: agreed_id if available, then spec_id, then UUID.

Source

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.

Source

pub fn effective_status(&self) -> String

Gets the effective status string, preferring custom_status if set

Source

pub fn set_status_from_str(&mut self, status_str: &str)

Sets the status from a string, using custom_status for non-standard values

Source

pub fn effective_priority(&self) -> String

Gets the effective priority string, preferring custom_priority if set

Source

pub fn set_priority_from_str(&mut self, priority_str: &str)

Sets the priority from a string, using custom_priority for non-standard values

Source

pub fn get_custom_field(&self, name: &str) -> Option<&String>

Gets a custom field value

Source

pub fn set_custom_field( &mut self, name: impl Into<String>, value: impl Into<String>, )

Sets a custom field value

Source

pub fn remove_custom_field(&mut self, name: &str) -> Option<String>

Removes a custom field

Source

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

Source

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

Source

pub fn record_change(&mut self, author: String, changes: Vec<FieldChange>)

Records a change to the requirement history

Source

pub fn field_change( field_name: &str, old_value: String, new_value: String, ) -> FieldChange

Helper to create a field change

Source

pub fn add_comment(&mut self, comment: Comment)

Adds a top-level comment to this requirement

Source

pub fn add_reply(&mut self, parent_id: Uuid, reply: Comment) -> Result<()>

Adds a reply to an existing comment

Source

pub fn find_comment_mut(&mut self, comment_id: &Uuid) -> Option<&mut Comment>

Finds a comment by ID (returns mutable reference)

Source

pub fn delete_comment(&mut self, comment_id: &Uuid) -> Result<()>

Deletes a comment by ID

Source

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

Source

pub fn needs_ai_evaluation(&self) -> bool

Check if AI evaluation is needed (never evaluated or stale)

Trait Implementations§

Source§

impl Clone for Requirement

Source§

fn clone(&self) -> Requirement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Requirement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Requirement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Requirement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TS for Requirement

Source§

type WithoutGenerics = Requirement

If this type does not have generic parameters, then 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 more
Source§

type OptionInnerType = Requirement

If the implementing type is 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 ident() -> String

Identifier of this type, excluding generic parameters.
Source§

fn docs() -> Option<String>

JSDoc comment to describe this type in TypeScript - when TS is derived, docs are automatically read from your doc comments or #[doc = ".."] attributes
Source§

fn name() -> String

Name of this type in TypeScript, including generic parameters
Source§

fn decl_concrete() -> String

Declaration of this type using the supplied generic arguments. The resulting TypeScript definition will not be generic. For that, see TS::decl(). If this type is not generic, then this function is equivalent to TS::decl().
Source§

fn decl() -> String

Declaration of this type, e.g. type User = { user_id: number, ... }. This function will panic if the type has no declaration. Read more
Source§

fn inline() -> String

Formats this types definition in TypeScript, e.g { user_id: number }. This function will panic if the type cannot be inlined.
Source§

fn inline_flattened() -> String

Flatten a type declaration.
This function will panic if the type cannot be flattened.
Source§

fn visit_generics(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all type parameters of this type.
Source§

fn output_path() -> Option<PathBuf>

Returns the output path to where T should be exported.
The returned path does not include the base directory from TS_RS_EXPORT_DIR. Read more
Source§

fn visit_dependencies(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all dependency of this type.
Source§

fn dependencies() -> Vec<Dependency>
where Self: 'static,

Resolves all dependencies of this type recursively.
Source§

fn export() -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem. To export this type together with all of its dependencies, use TS::export_all. Read more
Source§

fn export_all() -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem, together with all of its dependencies.
To export only this type, without its dependencies, use TS::export. Read more
Source§

fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>
where Self: 'static,

Manually export this type into the given directory, together with all of its dependencies.
To export only this type, without its dependencies, use TS::export. Read more
Source§

fn export_to_string() -> Result<String, ExportError>
where Self: 'static,

Manually generate bindings for this type, returning a String.
This function does not format the output, even if the format feature is enabled. Read more
Source§

fn default_output_path() -> Option<PathBuf>

Returns the output path to where T should be exported. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,