1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::fmt::Debug;

use super::Expression;

/// Owner, group and UNIX permissions
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Attributes<'t> {
    /// The owner to be set, if given
    pub owner: Option<Expression<'t>>,
    /// The group to be set, if given
    pub group: Option<Expression<'t>>,
    /// The UNIX permissions to be set, if given
    pub mode: Option<u16>,
}

impl<'t> Attributes<'t> {
    /// Returns true if no attributes are to be set by this entry
    pub fn is_empty(&self) -> bool {
        matches!(
            self,
            Attributes {
                owner: None,
                group: None,
                mode: None,
            }
        )
    }
}