Skip to main content

fancy_tree/tree/entry/attributes/
directory.rs

1//! Module for directory attributes.
2
3use super::interop::has_hidden_attribute;
4use std::fs::Metadata;
5
6/// Attributes for a directory.
7pub struct DirectoryAttributes {
8    /// Is the directory hidden?
9    hidden: bool,
10}
11
12impl DirectoryAttributes {
13    /// Creates new directory attributes.
14    #[inline]
15    pub(super) fn new(metadata: Metadata) -> Self {
16        Self {
17            hidden: has_hidden_attribute(&metadata),
18        }
19    }
20
21    /// Is the directory hidden?
22    #[inline]
23    pub const fn is_hidden(&self) -> bool {
24        self.hidden
25    }
26}