cargo_toml

Trait AbstractFilesystem

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

    // Provided methods
    fn read_root_workspace(
        &self,
        _rel_path_hint: Option<&str>,
    ) -> Result<(Vec<u8>, PathBuf)> { ... }
    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).

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 read_root_workspace( &self, _rel_path_hint: Option<&str>, ) -> Result<(Vec<u8>, PathBuf)>

parse_root_workspace is preferred.

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 bytes of 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.

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 read_root_workspace( &self, rel_path_hint: Option<&str>, ) -> Result<(Vec<u8>, PathBuf)>

Source§

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

Implementors§