pub struct WatchFile(/* private fields */);Expand description
A watch file in format 5 (RFC822/deb822 style)
Implementations§
Source§impl WatchFile
impl WatchFile
Sourcepub fn snapshot(&self) -> Self
pub fn snapshot(&self) -> Self
Capture an independent snapshot of this watch file.
See crate::parse::ParsedWatchFile::snapshot for semantics.
Sourcepub fn tree_eq(&self, other: &Self) -> bool
pub fn tree_eq(&self, other: &Self) -> bool
Returns true iff the syntax trees of self and other are
value-equal. An O(1) pointer-identity fast path makes this free for
trees that still share state with a recent snapshot().
Sourcepub fn defaults(&self) -> Option<Paragraph>
pub fn defaults(&self) -> Option<Paragraph>
Returns the defaults paragraph if it exists. The defaults paragraph is the second paragraph (after Version) if it has no Source field.
Sourcepub fn entries(&self) -> impl Iterator<Item = Entry> + '_
pub fn entries(&self) -> impl Iterator<Item = Entry> + '_
Returns an iterator over all entries in the watch file. The first paragraph contains defaults, subsequent paragraphs are entries.
Sourcepub fn inner_mut(&mut self) -> &mut Deb822
pub fn inner_mut(&mut self) -> &mut Deb822
Get a mutable reference to the underlying Deb822 object
Sourcepub fn add_entry(&mut self, source: &str, matching_pattern: &str) -> Entry
pub fn add_entry(&mut self, source: &str, matching_pattern: &str) -> Entry
Add a new entry to the watch file with the given source and matching pattern. Returns the newly created Entry.
§Example
use debian_watch::deb822::WatchFile;
use debian_watch::WatchOption;
let mut wf = WatchFile::new();
let mut entry = wf.add_entry("https://github.com/foo/bar/tags", ".*/v?([\\d.]+)\\.tar\\.gz");
entry.set_option(WatchOption::Component("upstream".to_string()));