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: String

The 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: PathBuf

Path to example file

path_type: ExampleType

Type of example file

Implementations

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 extension
  • path - The path to the example file. This can be a relative path and contain characters such as . and .. for instance.

Trait Implementations

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

order a sequence of ExampleFiles by the name field.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

Determine equality and hash using the path field.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Try to create an ExampleFile from a PathBuf object.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.