pub struct DocumentEditor;Expand description
Stateless entry point for typed editor operations.
Implementations§
Source§impl DocumentEditor
impl DocumentEditor
Sourcepub fn plan(input: &[u8], request: &EditRequest) -> Result<EditPlan, EditError>
pub fn plan(input: &[u8], request: &EditRequest) -> Result<EditPlan, EditError>
Validate a request and return its semantic dry-run plan.
Validation applies every operation to a private mutation clone, so a later invalid operation is reported before the caller receives any output bytes or touches a destination path.
Sourcepub fn apply(input: &[u8], request: &EditRequest) -> Result<Vec<u8>, EditError>
pub fn apply(input: &[u8], request: &EditRequest) -> Result<Vec<u8>, EditError>
Validate and apply a request, returning the edited DjVu bytes.
Sourcepub fn apply_to_path(
input: &Path,
output: &Path,
request: &EditRequest,
) -> Result<(), EditError>
pub fn apply_to_path( input: &Path, output: &Path, request: &EditRequest, ) -> Result<(), EditError>
Validate, apply, and atomically replace output with the edited bytes.
The complete request is validated before a sibling temporary file is created. The temporary file is flushed and synced before rename, so a failed request leaves an existing output untouched.
Trait Implementations§
Source§impl Clone for DocumentEditor
impl Clone for DocumentEditor
impl Copy for DocumentEditor
Source§impl Debug for DocumentEditor
impl Debug for DocumentEditor
Auto Trait Implementations§
impl Freeze for DocumentEditor
impl RefUnwindSafe for DocumentEditor
impl Send for DocumentEditor
impl Sync for DocumentEditor
impl Unpin for DocumentEditor
impl UnsafeUnpin for DocumentEditor
impl UnwindSafe for DocumentEditor
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
impl<T> CloneAny for T
impl<T> CloneAnySend for T
impl<T> CloneAnySendSync for T
impl<T> CloneAnySync for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more