Struct cargo_rx::ExampleFile
source · pub struct ExampleFile {
pub name: String,
pub path: PathBuf,
pub path_type: ExampleType,
pub required_features: Option<String>,
}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
required_features: Option<String>A space-separated list of required features for the example (or binary) to run.
The required-features field specifies which features the product needs in order to be built.
If any of the required features are not selected, the product will be skipped.
This is only relevant for the [[bin]], [[bench]], [[test]], and [[example]] sections,
it has no effect on [lib].
Implementations§
source§impl ExampleFile
impl ExampleFile
sourcepub fn new<P: AsRef<Path>>(
root: &Path,
name: String,
path: P,
required_features: Option<String>
) -> Self
pub fn new<P: AsRef<Path>>( root: &Path, name: String, path: P, required_features: Option<String> ) -> Self
Create an ExampleFile from a example name, a (possibly relative)
path, and a list of required features for the example.
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§
source§impl Clone for ExampleFile
impl Clone for ExampleFile
source§fn clone(&self) -> ExampleFile
fn clone(&self) -> ExampleFile
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ExampleFile
impl Debug for ExampleFile
source§impl Hash for ExampleFile
impl Hash for ExampleFile
source§impl Ord for ExampleFile
impl Ord for ExampleFile
order a sequence of ExampleFiles by the name field.
source§impl PartialEq<ExampleFile> for ExampleFile
impl PartialEq<ExampleFile> for ExampleFile
Determine equality and hash using the path field.
source§impl PartialEq<PathBuf> for ExampleFile
impl PartialEq<PathBuf> for ExampleFile
source§impl PartialOrd<ExampleFile> for ExampleFile
impl PartialOrd<ExampleFile> for ExampleFile
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl 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§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.