use super::error::Problems;
use super::fields::Fields;
use super::path::{PACKAGE_PATH_RULE, is_package_path};
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct DaemonPart {
pub command: String,
pub lazy: bool,
}
impl DaemonPart {
pub(crate) fn read(mut fields: Fields, problems: &mut Problems) -> Option<Self> {
let command =
fields.string_matching("command", is_package_path, PACKAGE_PATH_RULE, problems);
let lazy = fields.boolean("lazy", true, problems);
fields.finish(problems);
Some(Self {
command: command?,
lazy,
})
}
}