From a3b597ba7efbf7e0ddbe9d72e7202ea7a6b286a9 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 16 Sep 2025 21:13:35 +0800 Subject: perf: use explicit 'a lifetime instead of 'static --- src/client/client.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/client.rs') diff --git a/src/client/client.rs b/src/client/client.rs index 36afcf0..73a2c30 100644 --- a/src/client/client.rs +++ b/src/client/client.rs @@ -4,14 +4,14 @@ use whoami::{DesktopEnv, Language}; use crate::connector::Connection; -pub struct Client { +pub struct Client<'a, C: Connection> { pub connector: C, ip: Option, hostname: String, device_name: String, - os: &'static str, - cpu_arch: &'static str, + os: &'a str, + cpu_arch: &'a str, distro: String, desktop_env: DesktopEnv, username: String, @@ -20,7 +20,7 @@ pub struct Client { env: Vec<(String, String)>, } -impl std::fmt::Display for Client { +impl<'a, C: Connection> std::fmt::Display for Client<'a, C> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, @@ -40,7 +40,7 @@ impl std::fmt::Display for Client { } } -impl Client { +impl<'a, C: Connection> Client<'a, C> { pub fn new(connector: C) -> Result { let c = Self { ip: connector.get_ip(), -- cgit v1.2.3