[−][src]Function racer::get_rust_src_path
pub fn get_rust_src_path() -> Result<PathBuf, RustSrcPathError>
Get the path for Rust standard library source code.
Checks first the paths in the RUST_SRC_PATH
environment variable.
If the environment variable is not set, it checks the rust sys
root for the rust-src
component.
If that isn't available, checks /usr/local/src/rust/src
and
/usr/src/rust/src
as default values.
If the Rust standard library source code cannot be found, returns
Err(racer::RustSrcPathError::Missing)
.
If the path in RUST_SRC_PATH
or the path in rust sys root is invalid,
returns a corresponding error. If a valid path is found, returns that path.
Examples
extern crate racer; match racer::get_rust_src_path() { Ok(_path) => { // RUST_SRC_PATH is valid }, Err(racer::RustSrcPathError::Missing) => { // path is not set }, Err(racer::RustSrcPathError::DoesNotExist(_path)) => { // provided path doesnt point to valid file }, Err(racer::RustSrcPathError::NotRustSourceTree(_path)) => { // provided path doesn't have rustc src } }