Files
gentoo-utils/src/repo/profile/package/parsers.rs
2025-11-29 20:50:59 +00:00

14 lines
368 B
Rust

use mon::{Parser, tag};
use crate::{Parseable, atom::Atom, repo::profile::package::Package};
impl<'a> Parseable<'a, &'a str> for Package {
type Parser = impl Parser<&'a str, Output = Self>;
fn parser() -> Self::Parser {
Atom::parser()
.map(Package::Add)
.or(Atom::parser().preceded_by(tag("-")).map(Package::Remove))
}
}