mod utils

module utils

Module for various utility classes and structs.

Functions

fn check_for_manifest(paths: Vec<&Path>) -> Option<(PathBuf, CargoManifest)>

Check the provided paths for the Cargo.toml file.

Returns:

A Some value of the path that contained the Cargo manifest and the associated manifest for the first path contains a Cargo.toml file.

Traits

trait FileTopLevelDirective

Functions

fn get_doc_file(&self) -> &Path
fn get_text(self, format: &Format, max_visibility: &DirectiveVisibility) -> Vec<String>

Structs and Unions

struct CargoManifest(Manifest)

Newtype struct for the Cargo manifest from cargo_toml.

Implementations

impl CargoManifest

Functions

fn executable_files(&self, crate_dir: &Path) -> Vec<SourceCodeFile>

Get all the executable files in the crate.

fn lib_file(&self, crate_dir: &Path) -> Option<SourceCodeFile>

Get the library file for the crate, if any.

struct SourceCodeFile

Struct for the source code files encountered when scanning the crate.

path: PathBuf

The path to the file.

item: String

The name of the item in the file.

Implementations

impl SourceCodeFile

Functions

fn ast(&self) -> syn::File

Generate and return the AST for the file.

fn crate_name(&self) -> &str

Returns the name of the crate from the item name.

fn from_product(prd: &Product, crate_dir: &Path) -> Self

Create an instance for the product in the crate.

Args:
prd:

The product for which the file should be created.

crate_dir:

The path for the crate’s directory, used to generate the absolute path for the file.

fn to_parent_directory(&self) -> Self

Get the parent directory of the file for the item.

The item of the returned struct is the same as this struct’s item. This is mainly used for mod.rs and lib.rs files, where the directory name determines the item’s name.