pub struct WatchFile(/* private fields */);Expand description
A node in the syntax tree for $ast
Implementations§
Source§impl WatchFile
impl WatchFile
Source§impl WatchFile
impl WatchFile
Sourcepub fn version_node(&self) -> Option<Version>
pub fn version_node(&self) -> Option<Version>
Returns the version AST node of the watch file.
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.
Sourcepub fn set_version(&mut self, new_version: u32)
pub fn set_version(&mut self, new_version: u32)
Set the version of the watch file.
Sourcepub fn add_entry(&mut self, entry: Entry)
pub fn add_entry(&mut self, entry: Entry)
Add an entry to the watch file.
Appends a new entry to the end of the watch file.
§Examples
use debian_watch::{WatchFile, EntryBuilder};
let mut wf = WatchFile::new(Some(4));
// Add an entry using EntryBuilder
let entry = EntryBuilder::new("https://github.com/example/tags")
.matching_pattern(".*/v?(\\d\\S+)\\.tar\\.gz")
.build();
wf.add_entry(entry);
// Or use the builder pattern directly
wf.add_entry(
EntryBuilder::new("https://example.com/releases")
.matching_pattern(".*/(\\d+\\.\\d+)\\.tar\\.gz")
.opt("compression", "xz")
.version_policy("debian")
.build()
);Sourcepub fn from_reader<R: Read>(reader: R) -> Result<WatchFile, ParseError>
pub fn from_reader<R: Read>(reader: R) -> Result<WatchFile, ParseError>
Read a watch file from a Read object.
Sourcepub fn from_reader_relaxed<R: Read>(r: R) -> Result<Self, Error>
pub fn from_reader_relaxed<R: Read>(r: R) -> Result<Self, Error>
Read a watch file from a Read object, allowing syntax errors.
Sourcepub fn from_str_relaxed(s: &str) -> Self
pub fn from_str_relaxed(s: &str) -> Self
Parse a debian watch file from a string, allowing syntax errors.
Trait Implementations§
impl Eq for WatchFile
impl StructuralPartialEq for WatchFile
Auto Trait Implementations§
impl Freeze for WatchFile
impl !RefUnwindSafe for WatchFile
impl !Send for WatchFile
impl !Sync for WatchFile
impl Unpin for WatchFile
impl !UnwindSafe for WatchFile
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