pub struct FileNamed(/* private fields */);
Expand description
Defines a file with various name types. It is required that there exists exactly one file with a given name description.
use file_matcher::FileNamed;
// Find an exactly one file matching cat* within tests/assets folder
FileNamed::wildmatch("cat*")
.within("tests/assets")
.find()?;
// Check there exists a file matching cat* within tests/assets folder
FileNamed::wildmatch("cat*")
.within("tests/assets")
.exists()?;
Implementations§
Source§impl FileNamed
impl FileNamed
pub fn exact(name: impl Into<String>) -> Self
pub fn any(names: Vec<impl Into<String>>) -> Self
pub fn any_named(names: Vec<FileNamed>) -> Self
pub fn regex(pattern: impl Into<String>) -> Self
pub fn wildmatch(pattern: impl Into<String>) -> Self
pub fn within(&self, directory: impl Into<PathBuf>) -> OneEntry
pub fn alias(&self, name: impl Into<String>) -> EntityAlias
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileNamed
impl<'de> Deserialize<'de> for FileNamed
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl OneEntryNamed for FileNamed
impl OneEntryNamed for FileNamed
fn within_path_buf(&self, directory: PathBuf) -> OneEntry
fn entry_name(&self) -> &EntryName
fn entry_type(&self) -> &EntryType
fn name_alias(&self) -> Option<&str>
fn boxed(&self) -> Box<dyn OneEntryNamed>
Auto Trait Implementations§
impl Freeze for FileNamed
impl RefUnwindSafe for FileNamed
impl Send for FileNamed
impl Sync for FileNamed
impl Unpin for FileNamed
impl UnwindSafe for FileNamed
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