Fix lifetimes on StandardProperties.
This commit is contained in:
parent
b3382c66cd
commit
1b788f3f21
@ -50,7 +50,7 @@ pub enum TodoKeywordType {
|
||||
}
|
||||
|
||||
impl<'s> GetStandardProperties<'s> for DocumentElement<'s> {
|
||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||
match self {
|
||||
DocumentElement::Heading(inner) => inner,
|
||||
DocumentElement::Section(inner) => inner,
|
||||
@ -59,19 +59,19 @@ impl<'s> GetStandardProperties<'s> for DocumentElement<'s> {
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Document<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Section<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Heading<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ impl<'s> SetSource<'s> for Element<'s> {
|
||||
}
|
||||
|
||||
impl<'s> GetStandardProperties<'s> for Element<'s> {
|
||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||
match self {
|
||||
Element::Paragraph(inner) => inner,
|
||||
Element::PlainList(inner) => inner,
|
||||
|
@ -2,11 +2,11 @@ use super::StandardProperties;
|
||||
|
||||
pub trait GetStandardProperties<'s> {
|
||||
// TODO: Can I eliminate this dynamic dispatch, perhaps using nominal generic structs? Low prioritiy since this is not used during parsing.
|
||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties;
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s>;
|
||||
}
|
||||
|
||||
impl<'s, I: StandardProperties<'s>> GetStandardProperties<'s> for I {
|
||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
@ -99,61 +99,61 @@ pub struct TableRow<'s> {
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for PlainList<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for PlainListItem<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for GreaterBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for DynamicBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for FootnoteDefinition<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Drawer<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for PropertyDrawer<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for NodeProperty<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Table<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for TableRow<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
@ -115,93 +115,93 @@ impl<'s> Paragraph<'s> {
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Paragraph<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for TableCell<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Comment<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for VerseBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
impl<'s> StandardProperties<'s> for CommentBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
impl<'s> StandardProperties<'s> for ExampleBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
impl<'s> StandardProperties<'s> for ExportBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
impl<'s> StandardProperties<'s> for SrcBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Clock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for DiarySexp<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Planning<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for FixedWidthArea<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for HorizontalRule<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Keyword<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for BabelCall<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ pub struct Timestamp<'s> {
|
||||
}
|
||||
|
||||
impl<'s> GetStandardProperties<'s> for Object<'s> {
|
||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||
match self {
|
||||
Object::Bold(inner) => inner,
|
||||
Object::Italic(inner) => inner,
|
||||
@ -221,163 +221,163 @@ impl<'s> GetStandardProperties<'s> for Object<'s> {
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Bold<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Italic<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Underline<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for StrikeThrough<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Code<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Verbatim<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for RegularLink<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for RadioLink<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for RadioTarget<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for PlainLink<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for AngleLink<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for OrgMacro<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Entity<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for LatexFragment<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for ExportSnippet<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for FootnoteReference<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Citation<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for CitationReference<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for InlineBabelCall<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for InlineSourceBlock<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for LineBreak<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Target<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for StatisticsCookie<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Subscript<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Superscript<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for Timestamp<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> StandardProperties<'s> for PlainText<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
fn get_source<'b>(&'b self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ pub trait StandardProperties<'s> {
|
||||
/// Get the slice of the entire AST node.
|
||||
///
|
||||
/// This corresponds to :begin to :end in upstream org-mode's standard properties.
|
||||
fn get_source(&'s self) -> &'s str;
|
||||
fn get_source<'b>(&'b self) -> &'s str;
|
||||
|
||||
// Get the slice of the AST node's contents.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user