pub struct IssueDoc {
pub project: String,
pub path: PathBuf,
pub preamble: String,
pub tag_settings: TagSettings,
pub headings: Vec<IssueHeading>,
/* private fields */
}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:.
tag_settings: TagSettings#+FILETAGS:, #+TAGS:, and export tag keywords from the preamble.
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 an issue heading has no :ID:. A heading
whose first word is not a TODO keyword is Org around the issues,
not a failed parse.
Sourcepub fn render_string(&self) -> String
pub fn render_string(&self) -> String
The file body this document would write.
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 priority_spec(&self) -> PrioritySpec
pub fn priority_spec(&self) -> PrioritySpec
#+PRIORITIES: from this file and any local #+SETUPFILE:.
Sourcepub fn priorities_are_named(&self) -> bool
pub fn priorities_are_named(&self) -> bool
Whether the file or a local setupfile names #+PRIORITIES:.
Sourcepub fn default_create_priority(&self, cfg_default: char) -> char
pub fn default_create_priority(&self, cfg_default: char) -> char
Cookie for a new heading: the file default when named, else cfg_default.
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.