Give a lifetime parameter to LayoutCharacterDataHelpers

This commit is contained in:
Anthony Ramine 2020-03-29 19:25:46 +02:00
parent d87444cb1f
commit f0c98bfa5c

View file

@ -281,14 +281,14 @@ impl CharacterDataMethods for CharacterData {
}
#[allow(unsafe_code)]
pub trait LayoutCharacterDataHelpers {
unsafe fn data_for_layout(&self) -> &str;
pub trait LayoutCharacterDataHelpers<'dom> {
unsafe fn data_for_layout(self) -> &'dom str;
}
#[allow(unsafe_code)]
impl LayoutCharacterDataHelpers for LayoutDom<'_, CharacterData> {
impl<'dom> LayoutCharacterDataHelpers<'dom> for LayoutDom<'dom, CharacterData> {
#[inline]
unsafe fn data_for_layout(&self) -> &str {
unsafe fn data_for_layout(self) -> &'dom str {
&(*self.unsafe_get()).data.borrow_for_layout()
}
}