fix(node): fix lifetime parameter

This commit is contained in:
PoiScript 2019-08-07 18:27:41 +08:00
parent ce16610935
commit 115defe80e

View file

@ -7,7 +7,7 @@ use crate::Org;
pub struct HeadlineNode(pub(crate) NodeId); pub struct HeadlineNode(pub(crate) NodeId);
impl HeadlineNode { impl HeadlineNode {
pub fn get_title<'a>(self, org: &'a Org<'a>) -> &'a Title<'a> { pub fn get_title<'a: 'b, 'b>(self, org: &'b Org<'a>) -> &'b Title<'a> {
let title_node = org.arena[self.0].first_child().unwrap(); let title_node = org.arena[self.0].first_child().unwrap();
if let Element::Title(title) = org.arena[title_node].get() { if let Element::Title(title) = org.arena[title_node].get() {
title title
@ -16,7 +16,7 @@ impl HeadlineNode {
} }
} }
pub fn get_title_mut<'a>(self, org: &'a mut Org<'a>) -> &'a mut Title<'a> { pub fn get_title_mut<'a: 'b, 'b>(self, org: &'b mut Org<'a>) -> &'b mut Title<'a> {
let title_node = org.arena[self.0].first_child().unwrap(); let title_node = org.arena[self.0].first_child().unwrap();
if let Element::Title(title) = org.arena[title_node].get_mut() { if let Element::Title(title) = org.arena[title_node].get_mut() {
title title