Trait cargo_toml::AbstractFilesystem

source ·
pub trait AbstractFilesystem {
    // Required method
    fn file_names_in(&self, rel_path: &str) -> Result<HashSet<Box<str>>>;

    // Provided method
    fn parse_root_workspace(
        &self,
        rel_path_hint: Option<&str>
    ) -> Result<(Manifest<Value>, PathBuf), Error> { ... }
}
Expand description

This crate supports reading Cargo.toml not only from a real directory, but also directly from other sources, like tarballs or bare git repos (BYO directory reader).

The implementation must have a concept of the current directory, which is set to the crate’s manifest dir.

Required Methods§

source

fn file_names_in(&self, rel_path: &str) -> Result<HashSet<Box<str>>>

List all files and directories at the given relative path (no leading /).

Provided Methods§

source

fn parse_root_workspace( &self, rel_path_hint: Option<&str> ) -> Result<(Manifest<Value>, PathBuf), Error>

The rel_path_hint may be specified explicitly by package.workspace (it may be relative like "../", without Cargo.toml) or None, which means you have to search for workspace’s Cargo.toml in parent directories.

Read and parse the root workspace manifest TOML file and return the path it’s been read from. The path needs to be an absolute path, because it will be used as the base path for inherited readmes, and would be ambiguous otherwise.

Implementations on Foreign Types§

source§

impl<T> AbstractFilesystem for &T

source§

fn file_names_in(&self, rel_path: &str) -> Result<HashSet<Box<str>>>

source§

fn parse_root_workspace( &self, rel_path_hint: Option<&str> ) -> Result<(Manifest<Value>, PathBuf), Error>

Implementors§