This can be useful if the value was obtained using `raw_value_mut()`.
Unified · Split
| @@ -242,7 +242,7 @@ impl<'a, 'event> SectionMut<'a, 'event> { · 241 unmodified lines | ||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | impl<'event> Deref for SectionMut<'_, 'event> { |
| 245 | − type Target = file::section::Body<'event>; | |
| 245 | + type Target = file::Section<'event>; | |
| 246 | 246 | |
| 247 | 247 | fn deref(&self) -> &Self::Target { |
| 248 | 248 | self.section |
| @@ -3,6 +3,7 @@ use std::borrow::Cow; · 2 unmodified lines | ||
| 3 | 3 | use bstr::BStr; |
| 4 | 4 | |
| 5 | 5 | use crate::{ |
| 6 | + file, | |
| 6 | 7 | file::{mutable::section::SectionMut, Index, Size}, |
| 7 | 8 | lookup, |
| 8 | 9 | parse::section, |
| @@ -49,4 +50,14 @@ impl<'borrow, 'lookup, 'event> ValueMut<'borrow, 'lookup, 'event> { · 40 unmodified lines | ||
| 49 | 50 | self.size = Size(0); |
| 50 | 51 | } |
| 51 | 52 | } |
| 53 | + | |
| 54 | + /// Return the section containing the value. | |
| 55 | + pub fn section(&self) -> &file::Section<'event> { | |
| 56 | + &self.section | |
| 57 | + } | |
| 58 | + | |
| 59 | + /// Convert this value into its owning mutable section. | |
| 60 | + pub fn into_section_mut(self) -> file::SectionMut<'borrow, 'event> { | |
| 61 | + self.section | |
| 62 | + } | |
| 52 | 63 | } |