pub struct Root(/* private fields */);Expand description
The directory the tools read under.
Implementations§
Source§impl Root
impl Root
Sourcepub fn new(dir: impl AsRef<Path>) -> Result<Self>
pub fn new(dir: impl AsRef<Path>) -> Result<Self>
A root at dir, which must exist and be a directory.
§Errors
When dir cannot be resolved or is not a directory.
Sourcepub fn resolve(&self, requested: &str) -> Result<PathBuf, String>
pub fn resolve(&self, requested: &str) -> Result<PathBuf, String>
requested (relative to the root, or absolute), resolved, when
it is a regular file under the root.
§Errors
One message for every refusal: missing, outside the root, or not a regular file.
Sourcepub fn glob(&self, pattern: &str) -> Result<Vec<PathBuf>, String>
pub fn glob(&self, pattern: &str) -> Result<Vec<PathBuf>, String>
The regular files under the root that pattern (relative to
the root, or absolute) matches, sorted. Matches outside the
root, directories and other non-files are left out.
§Errors
An invalid pattern, or more than MAX_GLOB_FILES files.
Trait Implementations§
impl Eq for Root
impl StructuralPartialEq for Root
Auto Trait Implementations§
impl Forget for Root
impl Freeze for Root
impl Move for Root
impl RefUnwindSafe for Root
impl Send for Rootwhere
RawVecInner: Send,
impl Sync for Rootwhere
RawVecInner: Sync,
impl Unpin for Root
impl UnsafeUnpin for Root
impl UnwindSafe for Rootwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.