pub struct CommandStem(/* private fields */);Expand description
The file stem of a command (/usr/bin/NPX.cmd is npx), lowercased.
One constructor and one case rule serve the launcher rules, the TypeScript pin and builtin-server matching. The stem is lowercased once, so a comparison is case-insensitive on every host: on a case-insensitive file system (Windows, and macOS by default) a differently spelled command runs the same program, so a case-sensitive denylist (launchers) would let one slip through. For allow-style matches (the TypeScript pin, builtin-server matching) the same rule is merely generous on a case-sensitive file system: a differently cased name there fails to start rather than running anything unvetted. The names compared against must be lowercase.
§Examples
use mcpls_core::config::CommandStem;
let stem = CommandStem::of("/usr/local/bin/NPX.cmd");
assert!(stem.is("npx"));
assert!(stem.is_any(&["yarn", "npx"]));
assert_eq!(stem.as_str(), "npx");Implementations§
Trait Implementations§
Source§impl Clone for CommandStem
impl Clone for CommandStem
Source§impl Debug for CommandStem
impl Debug for CommandStem
impl Eq for CommandStem
Source§impl PartialEq for CommandStem
impl PartialEq for CommandStem
impl StructuralPartialEq for CommandStem
Auto Trait Implementations§
impl Freeze for CommandStem
impl RefUnwindSafe for CommandStem
impl Send for CommandStem
impl Sync for CommandStem
impl Unpin for CommandStem
impl UnsafeUnpin for CommandStem
impl UnwindSafe for CommandStem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.