Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/, pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#};
2
3 /// Takes the name of a binary target and returns the path to the target's executable.
4 pub fn executable_pathrust-analyzer cargo executable-path 1.0.1 executable_path().(name: &str) -> PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# {
5 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("CARGO_BIN_EXE_{}", name)) {
6 return value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().();
7 }
8
9 let mut path = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::current_exerust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/current_exe().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
10 path.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().();
11 if path.ends_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]ends_with().("deps") {
12 path.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().();
13 }
14 let exe = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(name) rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::constsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/consts/::EXE_SUFFIXrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/consts/EXE_SUFFIX.;
15 path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(exe);
16 path
17 }