pub enum ParsedWatchFile {
LineBased(WatchFile),
Deb822(WatchFile),
}Expand description
Parsed watch file that can be either line-based or deb822 format
Variants§
Implementations§
Source§impl ParsedWatchFile
impl ParsedWatchFile
Sourcepub fn new(version: u32) -> Result<Self, ParseError>
pub fn new(version: u32) -> Result<Self, ParseError>
Create a new empty watch file with the specified version.
- For version 5, creates a deb822-format watch file (requires
deb822feature) - For versions 1-4, creates a line-based watch file (requires
linebasedfeature)
§Examples
use debian_watch::parse::ParsedWatchFile;
let wf = ParsedWatchFile::new(5).unwrap();
assert_eq!(wf.version(), 5);Sourcepub fn entries(&self) -> impl Iterator<Item = ParsedEntry> + '_
pub fn entries(&self) -> impl Iterator<Item = ParsedEntry> + '_
Get an iterator over entries as ParsedEntry enum
Sourcepub fn add_entry(&mut self, source: &str, matching_pattern: &str) -> ParsedEntry
pub fn add_entry(&mut self, source: &str, matching_pattern: &str) -> ParsedEntry
Add a new entry to the watch file and return it.
For v5 (deb822) watch files, this adds a new paragraph with Source and Matching-Pattern fields. For v1-4 (line-based) watch files, this adds a new entry line.
Returns a ParsedEntry that can be used to query or modify the entry.
§Examples
use debian_watch::parse::ParsedWatchFile;
use debian_watch::WatchOption;
let mut wf = ParsedWatchFile::new(5).unwrap();
let mut entry = wf.add_entry("https://github.com/foo/bar/tags", ".*/v?([\\d.]+)\\.tar\\.gz");
entry.set_option(WatchOption::Component("upstream".to_string()));Trait Implementations§
Source§impl Debug for ParsedWatchFile
impl Debug for ParsedWatchFile
Auto Trait Implementations§
impl Freeze for ParsedWatchFile
impl !RefUnwindSafe for ParsedWatchFile
impl !Send for ParsedWatchFile
impl !Sync for ParsedWatchFile
impl Unpin for ParsedWatchFile
impl UnsafeUnpin for ParsedWatchFile
impl !UnwindSafe for ParsedWatchFile
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