From cb322bf72733a210bd41654bd3152f19dbb31059 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 6 Mar 2023 11:06:11 +0100 Subject: [PATCH] modernize generics of API using `impl` instead of 'the other way'. --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6bdd834..a44e348 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,7 +113,7 @@ use std::{ /// /// Sometimes, depending on the platform and system configuration, launchers *can* block. /// If you want to be sure they don't, use [`that_in_background()`] instead. -pub fn that>(path: T) -> io::Result<()> { +pub fn that(path: impl AsRef) -> io::Result<()> { let mut last_err = None; for mut cmd in commands(path) { match cmd.status_without_output() { @@ -147,7 +147,7 @@ pub fn that>(path: T) -> io::Result<()> { /// /// A [`std::io::Error`] is returned on failure. Because different operating systems /// handle errors differently it is recommend to not match on a certain error. -pub fn with>(path: T, app: impl Into) -> io::Result<()> { +pub fn with(path: impl AsRef, app: impl Into) -> io::Result<()> { let mut cmd = with_command(path, app); cmd.status_without_output().into_result(&cmd) } @@ -165,7 +165,7 @@ pub fn with>(path: T, app: impl Into) -> io::Result<()> /// # Ok(()) /// # } /// ``` -pub fn commands>(path: T) -> Vec { +pub fn commands(path: impl AsRef) -> Vec { os::commands(path) } @@ -180,14 +180,14 @@ pub fn commands>(path: T) -> Vec { /// # Ok(()) /// # } /// ``` -pub fn with_command>(path: T, app: impl Into) -> Command { +pub fn with_command(path: impl AsRef, app: impl Into) -> Command { os::with_command(path, app) } /// Open path with the default application in a new thread to assure it's non-blocking. /// /// See documentation of [`that()`] for more details. -pub fn that_in_background>(path: T) -> thread::JoinHandle> { +pub fn that_in_background(path: impl AsRef) -> thread::JoinHandle> { let path = path.as_ref().to_os_string(); thread::spawn(|| that(path)) }