Add Entry::replace_from_buffer()
This commit is contained in:
parent
fd91662ed9
commit
9e0d0d9f6c
1 changed files with 10 additions and 0 deletions
|
@ -959,6 +959,16 @@ impl Entry {
|
||||||
&mut self.content
|
&mut self.content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Replace both header and content of the entry by reading from buffer
|
||||||
|
///
|
||||||
|
/// If an error is returned, the contents of neither the header nor the content are modified.
|
||||||
|
pub fn replace_from_buffer(&mut self, buf: &str) -> Result<()> {
|
||||||
|
let (header, content) = ::util::entry_buffer_to_header_content(buf)?;
|
||||||
|
self.content = content;
|
||||||
|
self.header = header;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Verify the entry.
|
/// Verify the entry.
|
||||||
///
|
///
|
||||||
/// Currently, this only verifies the header. This might change in the future.
|
/// Currently, this only verifies the header. This might change in the future.
|
||||||
|
|
Loading…
Reference in a new issue