pub enum Element {
Task {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: TaskData,
},
Note {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: NoteData,
},
Log {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: LogData,
},
Reminder {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: ReminderData,
},
MpsGroup {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: MpsGroupData,
},
Character {
raw_args: String,
refs: Vec<u64>,
body_str: String,
data: CharacterData,
},
Unknown {
sign: String,
raw_args: String,
refs: Vec<u64>,
body_str: String,
},
}Expand description
All element types the parser can produce. Using an enum (not trait objects): exhaustive matching, no heap allocation per element, and pattern matching is idiomatic for the display/filter/export branches.
Variants§
Implementations§
Source§impl Element
impl Element
pub fn kind(&self) -> ElementKind
pub fn is_mps_group(&self) -> bool
pub fn body_str(&self) -> &str
pub fn refs(&self) -> &[u64]
pub fn sign(&self) -> &str
Sourcepub fn raw_args(&self) -> &str
pub fn raw_args(&self) -> &str
The raw args string as it appeared in the source file (e.g. “work, status: open”).
Sourcepub fn typed_attrs(&self) -> Vec<(String, String)>
pub fn typed_attrs(&self) -> Vec<(String, String)>
Typed (named) attributes, excluding tags. Used by rewrite_element to merge new attrs. Only includes attributes that were actually set (no defaults for absent optional attrs).
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
True if this element is an Unknown type (sign not recognised by the parser).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
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
Mutably borrows from an owned value. Read more