2015-10-06 18:35:41 +08:00
|
|
|
[package]
|
|
|
|
name = "which"
|
2023-01-20 17:11:35 +08:00
|
|
|
version = "4.4.0"
|
2021-03-17 10:59:33 -06:00
|
|
|
edition = "2018"
|
2018-07-26 12:42:47 +08:00
|
|
|
authors = ["Harry Fei <tiziyuanfang@gmail.com>"]
|
|
|
|
repository = "https://github.com/harryfei/which-rs.git"
|
2017-10-05 18:02:00 +08:00
|
|
|
documentation = "https://docs.rs/which/"
|
2015-10-06 18:35:41 +08:00
|
|
|
license = "MIT"
|
2018-12-02 08:59:38 +01:00
|
|
|
description = "A Rust equivalent of Unix command \"which\". Locate installed executable in cross platforms."
|
2018-02-27 16:56:55 +08:00
|
|
|
readme = "README.md"
|
2017-10-05 00:08:55 +08:00
|
|
|
categories = ["os", "filesystem"]
|
2017-06-14 11:04:15 +08:00
|
|
|
keywords = ["which", "which-rs", "unix", "command"]
|
2016-06-07 14:02:38 -04:00
|
|
|
|
|
|
|
[dependencies]
|
2022-02-05 14:56:46 +08:00
|
|
|
either = "1.6.1"
|
2022-03-20 19:26:09 +08:00
|
|
|
libc = "0.2.121"
|
|
|
|
regex = { version = "1.5.5", optional = true }
|
2018-11-26 16:40:38 -08:00
|
|
|
|
Windows: various performance optimisations
• Parse PATHEXT once only, with the new platform-specific dependency
lazy_static. (If anyone changes PATHEXT in the middle of process
invocation, I don’t even want to *know* what they’re doing.) This
should reduce allocations on subsequent calls by at least 13 on a
typical machine.
• Skip an unnecessary clone of that Vec, and of every item in it.
That’s another dozen or so allocations saved on every call.
• Make has_executable_extension take &[S] instead of &Vec<S>, in line
with accepted Best Practices™. There’s probably no difference in the
compiled artefact, because the optimiser will already have been fixing
it.
• Remove the broken PATHEXT fallback case handling. It was intended to
make it support .exe if PATHEXT was missing or non-Unicode, but due to
using EXE_EXTENSION ("exe") instead of EXE_SUFFIX (".exe"), it
actually matched the .xe extension. I contemplated fixing that and
making it use .unwrap_or_else(|| …) instead of .unwrap_or(…) to save
another allocation, but decided that it was better not to include that
fallback anyway: for PATHEXT to be missing or non-Unicode is a severe
breach of contract, and I doubt Windows would actually work properly;
so there’s no need for such a dubious fallback.
There are still further performance optimisations that can be made, most
notably around performing exact allocations rather than just converting
to a PathBuf and pushing bytes willy-nilly, which may require
reallocation. But this lot is a good start.
2018-12-19 11:41:04 +11:00
|
|
|
[target.'cfg(windows)'.dependencies]
|
2022-06-11 19:47:11 +02:00
|
|
|
once_cell = "1"
|
Windows: various performance optimisations
• Parse PATHEXT once only, with the new platform-specific dependency
lazy_static. (If anyone changes PATHEXT in the middle of process
invocation, I don’t even want to *know* what they’re doing.) This
should reduce allocations on subsequent calls by at least 13 on a
typical machine.
• Skip an unnecessary clone of that Vec, and of every item in it.
That’s another dozen or so allocations saved on every call.
• Make has_executable_extension take &[S] instead of &Vec<S>, in line
with accepted Best Practices™. There’s probably no difference in the
compiled artefact, because the optimiser will already have been fixing
it.
• Remove the broken PATHEXT fallback case handling. It was intended to
make it support .exe if PATHEXT was missing or non-Unicode, but due to
using EXE_EXTENSION ("exe") instead of EXE_SUFFIX (".exe"), it
actually matched the .xe extension. I contemplated fixing that and
making it use .unwrap_or_else(|| …) instead of .unwrap_or(…) to save
another allocation, but decided that it was better not to include that
fallback anyway: for PATHEXT to be missing or non-Unicode is a severe
breach of contract, and I doubt Windows would actually work properly;
so there’s no need for such a dubious fallback.
There are still further performance optimisations that can be made, most
notably around performing exact allocations rather than just converting
to a PathBuf and pushing bytes willy-nilly, which may require
reallocation. But this lot is a good start.
2018-12-19 11:41:04 +11:00
|
|
|
|
2016-06-07 15:12:43 -04:00
|
|
|
[dev-dependencies]
|
2022-03-20 19:26:09 +08:00
|
|
|
tempfile = "3.3.0"
|
2021-11-30 21:34:57 +01:00
|
|
|
|
|
|
|
[package.metadata.docs.rs]
|
|
|
|
all-features = true
|