pub struct Editor { /* private fields */ }Expand description
In-memory representation of a config we’re editing. Created via
Editor::open, mutated via Editor::add / Editor::remove,
persisted via Editor::save.
Implementations§
Source§impl Editor
impl Editor
pub fn open(path: &Path) -> Result<Self, EditError>
Sourcepub fn operations(&self) -> Result<Vec<String>, EditError>
pub fn operations(&self) -> Result<Vec<String>, EditError>
Snapshot of the current [server].operations list (raw strings,
not parsed selectors).
Sourcepub fn add(&mut self, selector: &str) -> Result<bool, EditError>
pub fn add(&mut self, selector: &str) -> Result<bool, EditError>
Append a selector to [server].operations, creating the
section, framework key, and array as needed.
Returns true if the entry was added, false if it was already
present (no edit applied).
Sourcepub fn remove(&mut self, selector: &str) -> Result<bool, EditError>
pub fn remove(&mut self, selector: &str) -> Result<bool, EditError>
Remove the first entry equal to selector. Returns true if
something was removed, false if it was absent.
pub fn save(&self) -> Result<(), EditError>
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl Send for Editor
impl Sync for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
impl UnwindSafe for Editor
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