pub struct Update { /* private fields */ }Expand description
Changes for MdzArchive::update. Build one with the methods below.
let archive = mdzip_core::MdzArchive::open(data)?;
let changes = mdzip_core::Update::new()
.write("images/logo.png", b"\x89PNG")
.set("title", "New title");
let updated = mdzip_core::MdzArchive::open(archive.update(&changes)?)?;
assert_eq!(updated.title(), Some("New title"));Implementations§
Source§impl Update
impl Update
Sourcepub fn write(self, path: impl Into<String>, content: impl AsRef<[u8]>) -> Self
pub fn write(self, path: impl Into<String>, content: impl AsRef<[u8]>) -> Self
Add or replace a file.
Sourcepub fn remove(self, path: impl Into<String>) -> Self
pub fn remove(self, path: impl Into<String>) -> Self
Remove a file, directory entry or symbolic link.
Sourcepub fn set(self, field: impl Into<String>, value: impl Into<Value>) -> Self
pub fn set(self, field: impl Into<String>, value: impl Into<Value>) -> Self
Set a top-level manifest field.
Sourcepub fn entry_point(self, path: impl Into<String>) -> Self
pub fn entry_point(self, path: impl Into<String>) -> Self
Change the entry point. Without this, an update that would change which file the entry point resolves to fails.
Sourcepub fn when(self, when: SystemTime) -> Self
pub fn when(self, when: SystemTime) -> Self
Timestamp for modified and written entries. Defaults to now.
Sourcepub fn keep_line_endings(self) -> Self
pub fn keep_line_endings(self) -> Self
Keep CRLF in written Markdown files.
Sourcepub fn drop_special_files(self) -> Self
pub fn drop_special_files(self) -> Self
Drop symbolic link entries (when the user agrees, Section 14.1).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnsafeUnpin for Update
impl UnwindSafe for Update
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more