Struct cargo_rx::ExampleFile
source · [−]pub struct ExampleFile {
pub name: String,
pub path: PathBuf,
pub path_type: ExampleType,
}Expand description
Represents an example file in a Cargo project.
Fields
name: StringThe file stem (i.e. filename without the extension) for an
example file, or the folder name in the case of a main.rs
example within a sub-folder.
path: PathBufPath to example file
path_type: ExampleTypeType of example file
Implementations
sourceimpl ExampleFile
impl ExampleFile
sourcepub fn from_name_and_path<P: AsRef<Path>>(
root: &Path,
name: String,
path: P
) -> Self
pub fn from_name_and_path<P: AsRef<Path>>(
root: &Path,
name: String,
path: P
) -> Self
Create an ExampleFile from a example name and a (possibly relative)
path.
Arguments
root- The current working directory, used in case the path is relative.name- The name of the example file, without the extensionpath- The path to the example file. This can be a relative path and contain characters such as.and..for instance.
Trait Implementations
sourceimpl Debug for ExampleFile
impl Debug for ExampleFile
sourceimpl Hash for ExampleFile
impl Hash for ExampleFile
sourceimpl Ord for ExampleFile
impl Ord for ExampleFile
order a sequence of ExampleFiles by the name field.
sourceimpl PartialEq<ExampleFile> for ExampleFile
impl PartialEq<ExampleFile> for ExampleFile
Determine equality and hash using the path field.
sourceimpl PartialEq<PathBuf> for ExampleFile
impl PartialEq<PathBuf> for ExampleFile
sourceimpl PartialOrd<ExampleFile> for ExampleFile
impl PartialOrd<ExampleFile> for ExampleFile
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl TryFrom<PathBuf> for ExampleFile
impl TryFrom<PathBuf> for ExampleFile
impl Eq for ExampleFile
impl StructuralEq for ExampleFile
Auto Trait Implementations
impl RefUnwindSafe for ExampleFile
impl Send for ExampleFile
impl Sync for ExampleFile
impl Unpin for ExampleFile
impl UnwindSafe for ExampleFile
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.