Skip to main content

KeyedDirs

Struct KeyedDirs 

Source
pub struct KeyedDirs { /* private fields */ }
Expand description

The keyed directories of a policy.

Implementations§

Source§

impl KeyedDirs

Source

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.

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, dir: &str) -> Option<&KeyedDir>

The keyed directory dir.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for KeyedDirs

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyedDirs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KeyedDirs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.