Skip to main content

ParsedWatchFile

Enum ParsedWatchFile 

Source
pub enum ParsedWatchFile {
    LineBased(WatchFile),
    Deb822(WatchFile),
}
Expand description

Parsed watch file that can be either line-based or deb822 format

Variants§

§

LineBased(WatchFile)

Line-based watch file (v1-4)

§

Deb822(WatchFile)

Deb822 watch file (v5)

Implementations§

Source§

impl ParsedWatchFile

Source

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 deb822 feature)
  • For versions 1-4, creates a line-based watch file (requires linebased feature)
§Examples
use debian_watch::parse::ParsedWatchFile;

let wf = ParsedWatchFile::new(5).unwrap();
assert_eq!(wf.version(), 5);
Source

pub fn version(&self) -> u32

Get the version of the watch file

Source

pub fn entries(&self) -> impl Iterator<Item = ParsedEntry> + '_

Get an iterator over entries as ParsedEntry enum

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParsedWatchFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.