Skip to main content

IssueDoc

Struct IssueDoc 

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

Project directory name this file belongs to.

§path: PathBuf

Path of the issues.org this document was parsed from or will write to.

§preamble: String

File 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

Source

pub fn empty(project: &str, path: PathBuf) -> Self

An empty document with the house preamble and no headings.

Source

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.

Source

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.

Source

pub fn render_string(&self) -> String

The file body this document would write.

Source

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.

Source

pub fn priority_spec(&self) -> PrioritySpec

#+PRIORITIES: from this file and any local #+SETUPFILE:.

Source

pub fn priorities_are_named(&self) -> bool

Whether the file or a local setupfile names #+PRIORITIES:.

Source

pub fn default_create_priority(&self, cfg_default: char) -> char

Cookie for a new heading: the file default when named, else cfg_default.

Source

pub fn known_ids(&self) -> Vec<String>

Every heading id in this document, in file order.

Source

pub fn upsert(&mut self, heading: IssueHeading)

Replace a heading with the same id, or append if none matches.

Source

pub fn remove(&mut self, id: &str) -> Option<IssueHeading>

Remove the heading with id, if it is in this document.

Trait Implementations§

Source§

impl Clone for IssueDoc

Source§

fn clone(&self) -> IssueDoc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IssueDoc

Source§

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

Formats the value using the given formatter. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.