Struct debian_analyzer::control::TemplatedControlEditor
source · pub struct TemplatedControlEditor { /* private fields */ }Expand description
An editor for a control file that may be generated from a template.
This editor will automatically expand the template if it does not exist. It will also automatically update the template if the control file is changed.
§Example
use std::path::Path;
use debian_analyzer::control::TemplatedControlEditor;
let td = tempfile::tempdir().unwrap();
let mut editor = TemplatedControlEditor::create(td.path().join("control")).unwrap();
editor.add_source("foo").set_architecture(Some("all"));
editor.commit().unwrap();Implementations§
source§impl TemplatedControlEditor
impl TemplatedControlEditor
pub fn create<P: AsRef<Path>>(control_path: P) -> Result<Self, EditorError>
pub fn template_type(&self) -> Option<TemplateType>
pub fn open<P: AsRef<Path>>(control_path: P) -> Result<Self, EditorError>
pub fn new<P: AsRef<Path>>( control_path: P, allow_missing: bool, ) -> Result<Self, EditorError>
Methods from Deref<Target = Control>§
pub fn as_mut_deb822(&mut self) -> &mut Deb822
pub fn as_deb822(&self) -> &Deb822
pub fn source(&self) -> Option<Source>
pub fn binaries(&self) -> impl Iterator<Item = Binary>
sourcepub fn add_source(&mut self, name: &str) -> Source
pub fn add_source(&mut self, name: &str) -> Source
sourcepub fn add_binary(&mut self, name: &str) -> Binary
pub fn add_binary(&mut self, name: &str) -> Binary
pub fn wrap_and_sort( &mut self, indentation: Indentation, immediate_empty_line: bool, max_line_length_one_liner: Option<usize>, )
Trait Implementations§
source§impl DerefMut for TemplatedControlEditor
impl DerefMut for TemplatedControlEditor
source§impl Editor<Control> for TemplatedControlEditor
impl Editor<Control> for TemplatedControlEditor
source§fn orig_content(&self) -> Option<&[u8]>
fn orig_content(&self) -> Option<&[u8]>
The original content, if any - without reformatting
source§fn rewritten_content(&self) -> Option<&[u8]>
fn rewritten_content(&self) -> Option<&[u8]>
The original content, but rewritten with our parser/serializer
fn is_generated(&self) -> bool
source§fn has_changed(&self) -> bool
fn has_changed(&self) -> bool
Whether the file has changed
Auto Trait Implementations§
impl Freeze for TemplatedControlEditor
impl !RefUnwindSafe for TemplatedControlEditor
impl !Send for TemplatedControlEditor
impl !Sync for TemplatedControlEditor
impl Unpin for TemplatedControlEditor
impl !UnwindSafe for TemplatedControlEditor
Blanket Implementations§
source§impl<E> AbstractControlEditor for E
impl<E> AbstractControlEditor for E
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