pub struct KeyedDirs { /* private fields */ }Expand description
The keyed directories of a policy.
Implementations§
Source§impl KeyedDirs
impl KeyedDirs
Sourcepub fn new<'a>(
entries: impl IntoIterator<Item = (&'a str, &'a str, Compare)>,
) -> Result<Self, String>
pub fn new<'a>( entries: impl IntoIterator<Item = (&'a str, &'a str, Compare)>, ) -> Result<Self, String>
Compiles (directory, pattern, compare). Refused: more than
MAX_DIRS, a directory that is no plain relative path, a pattern
longer than MAX_PATTERN, that does not compile within the size
limit, or that has other than exactly one capture group.
pub fn is_empty(&self) -> bool
Sourcepub fn of<'p>(&self, path: &'p str) -> Option<(&KeyedDir, &'p str)>
pub fn of<'p>(&self, path: &'p str) -> Option<(&KeyedDir, &'p str)>
The keyed directory that holds path directly, and the file’s name.
A file in a directory under it is not one of its files.
Sourcepub fn clashes<'p>(
&self,
paths: impl IntoIterator<Item = &'p str>,
) -> BTreeSet<String>
pub fn clashes<'p>( &self, paths: impl IntoIterator<Item = &'p str>, ) -> BTreeSet<String>
The keys, as dir#key, that two or more of paths have in one keyed
directory.
Sourcepub fn taken<'p>(
&self,
added: &[String],
tree: impl IntoIterator<Item = &'p str> + Clone,
) -> Vec<String>
pub fn taken<'p>( &self, added: &[String], tree: impl IntoIterator<Item = &'p str> + Clone, ) -> Vec<String>
The keys, as dir#key, of the files in added that another file of
tree (the paths of the tree they are in) has too.
Sourcepub fn next_key<'p>(
&self,
dir: &str,
tree: impl IntoIterator<Item = &'p str>,
reserved: impl IntoIterator<Item = &'p str>,
) -> Option<String>
pub fn next_key<'p>( &self, dir: &str, tree: impl IntoIterator<Item = &'p str>, reserved: impl IntoIterator<Item = &'p str>, ) -> Option<String>
The number after the highest key that a file of tree has in dir
or that reserved holds; 1 when there is none. None for a text
directory, whose keys have no order, or one that is not keyed.