pub struct IssueDoc {
pub project: String,
pub path: PathBuf,
pub preamble: String,
pub headings: Vec<IssueHeading>,
}Expand description
One project’s issues.org: a preamble followed by top-level headings.
Fields§
§project: StringProject directory name this file belongs to.
path: PathBufPath of the issues.org this document was parsed from or will write to.
preamble: StringFile header above the first heading, including #+TODO:.
headings: Vec<IssueHeading>Top-level issue headings, in file order.
Implementations§
Source§impl IssueDoc
impl IssueDoc
Sourcepub fn empty(project: &str, path: PathBuf) -> Self
pub fn empty(project: &str, path: PathBuf) -> Self
An empty document with the house preamble and no headings.
Sourcepub fn parse_file(project: &str, path: &Path) -> Result<Self>
pub fn parse_file(project: &str, path: &Path) -> Result<Self>
Parse path, or produce an empty document when the file is absent.
§Errors
Returns an error if the file exists but cannot be read or parsed.
Sourcepub fn parse(project: &str, path: PathBuf, content: &str) -> Result<Self>
pub fn parse(project: &str, path: PathBuf, content: &str) -> Result<Self>
Parse content as an issues.org for project.
§Errors
Returns an error if a heading has an unknown TODO keyword or no :ID:.
Sourcepub fn write(&self) -> Result<()>
pub fn write(&self) -> Result<()>
Render and replace the file through a uniquely named temporary. Callers
hold with_issues_lock around the parse and this write.
§Errors
Returns an error if the parent directory cannot be created, the temporary cannot be written, or the rename cannot publish it.
Sourcepub fn upsert(&mut self, heading: IssueHeading)
pub fn upsert(&mut self, heading: IssueHeading)
Replace a heading with the same id, or append if none matches.
Sourcepub fn remove(&mut self, id: &str) -> Option<IssueHeading>
pub fn remove(&mut self, id: &str) -> Option<IssueHeading>
Remove the heading with id, if it is in this document.