pub struct Requirement { /* private fields */ }Expand description
A requirement is a document used to describe a system.
It can represent a user requirement, a specification, etc. Requirements can have dependencies between them, such that one requirement satisfies, fulfils, verifies (etc.) another requirement.
Implementations§
Source§impl Requirement
impl Requirement
Sourcepub fn new(hrid: Hrid, content: String) -> Self
pub fn new(hrid: Hrid, content: String) -> Self
Construct a new Requirement from a human-readable ID and its content.
A new UUID is automatically generated.
The tags on the requirement
Set the tags on the requirement.
this replaces any existing tags.
Sourcepub fn add_tag(&mut self, tag: String) -> bool
pub fn add_tag(&mut self, tag: String) -> bool
Add a tag to the requirement.
returns ‘true’ if a new tag was inserted, or ‘false’ if it was already present.
Sourcepub const fn hrid(&self) -> &Hrid
pub const fn hrid(&self) -> &Hrid
The human-readable identifier for this requirement.
In normal usage these should be stable
Sourcepub fn fingerprint(&self) -> String
pub fn fingerprint(&self) -> String
Returns a value generated by hashing the content of the Requirement.
Any change to the requirement will change the fingerprint. This is used to determine when links are ‘suspect’. Meaning that because a requirement has been modified, related or dependent requirements also need to be reviewed to ensure consistency.
Sourcepub fn add_parent(
&mut self,
parent_id: Uuid,
parent_info: Parent,
) -> Option<Parent>
pub fn add_parent( &mut self, parent_id: Uuid, parent_info: Parent, ) -> Option<Parent>
Add a parent to the requirement, keyed by UUID.
Sourcepub fn parents(&self) -> impl Iterator<Item = (Uuid, &Parent)>
pub fn parents(&self) -> impl Iterator<Item = (Uuid, &Parent)>
Return an iterator over the requirement’s ‘parents’
Sourcepub fn parents_mut(&mut self) -> impl Iterator<Item = (Uuid, &mut Parent)>
pub fn parents_mut(&mut self) -> impl Iterator<Item = (Uuid, &mut Parent)>
Return a mutable iterator over the requirement’s ‘parents’
Sourcepub fn load(path: &Path, hrid: String) -> Result<Self, LoadError>
pub fn load(path: &Path, hrid: String) -> Result<Self, LoadError>
Reads a requirement from the given file path.
Note the path here is the path to the directory. The filename is determined by the HRID
§Errors
Returns an error if the file does not exist, cannot be read from, or has malformed YAML frontmatter.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes the requirement to the given file path. Creates the file if it doesn’t exist, or overwrites it if it does.
Note the path here is the path to the directory. The filename is determined by the HRID.
§Errors
This method returns an error if the path cannot be written to.
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 PartialEq for Requirement
impl PartialEq for Requirement
impl StructuralPartialEq for Requirement
Auto Trait Implementations§
impl Freeze for Requirement
impl RefUnwindSafe for Requirement
impl Send for Requirement
impl Sync for Requirement
impl Unpin for Requirement
impl UnwindSafe for Requirement
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<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more