Skip to main content

Editor

Trait Editor 

Source
pub trait Editor<T>: Deref<Target = T> + DerefMut<Target = T> {
    // Required method
    fn commit(self: Box<Self>) -> Result<(), Error>;
}
Expand description

An editor handle for a single file in a Workspace.

The parsed value is reachable via Deref/DerefMut; mutate it as you would the bare type. Changes are persisted by calling commit. Dropping an editor without committing discards the changes (and emits a warning) — explicit commit is required so that serialisation failures can be reported.

T is the parsed representation (e.g. debian_control::lossless::Control).

Required Methods§

Source

fn commit(self: Box<Self>) -> Result<(), Error>

Persist any modifications to the underlying workspace.

For a tree-backed workspace this writes the file back to disk; for an editor-backed workspace it records a TextEdit against the buffer. Calling commit more than once is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§