pub struct KittyBuilder { /* private fields */ }Implementations§
Source§impl KittyBuilder
impl KittyBuilder
pub fn new() -> Self
Sourcepub fn socket_path<P: AsRef<Path>>(self, path: P) -> Self
pub fn socket_path<P: AsRef<Path>>(self, path: P) -> Self
Examples found in repository?
examples/test-simple-command.rs (line 6)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-101555.sock")
7 .connect()
8 .await?;
9
10 let cmd = CommandBuilder::new("ls").build();
11 let result = kitty.execute(&cmd).await;
12 println!("LS Result: {:?}", result);
13
14 Ok(())
15}More examples
examples/test-encrypted-simple.rs (line 6)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-101555.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 let cmd = CommandBuilder::new("ls").build();
12 let result = kitty.execute(&cmd).await;
13 println!("LS Result: {:?}", result);
14
15 Ok(())
16}examples/test-debug.rs (line 8)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 // Test without password
6 println!("=== Testing without password ===");
7 let mut kitty = Kitty::builder()
8 .socket_path("/run/user/1000/kitty-101555.sock")
9 .connect()
10 .await?;
11
12 let cmd = CommandBuilder::new("ls").build();
13 println!("Command: {:?}", cmd);
14 let result = kitty.execute(&cmd).await;
15 println!("Result: {:?}", result);
16
17 Ok(())
18}examples/test_font.rs (line 6)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-757336.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 println!("Testing set-font-size increment command...");
12
13 // Try increment
14 let cmd = SetFontSizeCommand::builder()
15 .size(0.0)
16 .increment_op("+".to_string())
17 .build()
18 .to_message()?;
19
20 let result = kitty.execute(&cmd).await?;
21 println!("Increment result: ok={}, data={:?}, error={:?}", result.ok, result.data, result.error);
22
23 Ok(())
24}examples/test-connectivity.rs (line 12)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 // Find kitty socket
6 let socket_path = find_kitty_socket()?;
7
8 println!("Connecting to: {}", socket_path);
9
10 // Test basic connection
11 let mut kitty = Kitty::builder()
12 .socket_path(&socket_path)
13 .connect()
14 .await
15 .map_err(|e| format!("Connection failed: {}", e))?;
16
17 println!("✓ Connected successfully!");
18
19 // Test sending a simple command
20 use kitty_rc::command::CommandBuilder;
21
22 let cmd = CommandBuilder::new("ls")
23 .build();
24
25 match kitty.execute(&cmd).await {
26 Ok(response) => {
27 println!("✓ Command executed successfully!");
28 if let Some(data) = response.data {
29 println!("Response: {}", data);
30 }
31 }
32 Err(e) => {
33 eprintln!("✗ Command failed: {}", e);
34 }
35 }
36
37 Ok(())
38}examples/test-encrypted.rs (line 13)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 // Find kitty socket
7 let socket_path = find_kitty_socket()?;
8
9 println!("Connecting to: {}", socket_path);
10
11 // Test encrypted connection
12 let mut kitty = Kitty::builder()
13 .socket_path(&socket_path)
14 .password(&read_password()?)
15 .connect()
16 .await
17 .map_err(|e| format!("Connection failed: {}", e))?;
18
19 println!("✓ Connected successfully (encrypted)!");
20
21 // Test sending a simple command
22 use kitty_rc::command::CommandBuilder;
23
24 let cmd = CommandBuilder::new("ls")
25 .build();
26
27 match kitty.execute(&cmd).await {
28 Ok(response) => {
29 println!("✓ Encrypted command executed successfully!");
30 println!(" Response: {:?}", response);
31 }
32 Err(e) => {
33 eprintln!("✗ Encrypted command failed: {}", e);
34 if let Some(source) = Error::source(&e) {
35 eprintln!(" Error source: {}", source);
36 }
37 }
38 }
39
40 Ok(())
41}pub fn from_pid(self, pid: u32) -> Self
pub fn timeout(self, duration: Duration) -> Self
Sourcepub fn password(self, password: impl Into<String>) -> Self
pub fn password(self, password: impl Into<String>) -> Self
Examples found in repository?
examples/test-encrypted-simple.rs (line 7)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-101555.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 let cmd = CommandBuilder::new("ls").build();
12 let result = kitty.execute(&cmd).await;
13 println!("LS Result: {:?}", result);
14
15 Ok(())
16}More examples
examples/test_font.rs (line 7)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-757336.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 println!("Testing set-font-size increment command...");
12
13 // Try increment
14 let cmd = SetFontSizeCommand::builder()
15 .size(0.0)
16 .increment_op("+".to_string())
17 .build()
18 .to_message()?;
19
20 let result = kitty.execute(&cmd).await?;
21 println!("Increment result: ok={}, data={:?}, error={:?}", result.ok, result.data, result.error);
22
23 Ok(())
24}examples/test-encrypted.rs (line 14)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 // Find kitty socket
7 let socket_path = find_kitty_socket()?;
8
9 println!("Connecting to: {}", socket_path);
10
11 // Test encrypted connection
12 let mut kitty = Kitty::builder()
13 .socket_path(&socket_path)
14 .password(&read_password()?)
15 .connect()
16 .await
17 .map_err(|e| format!("Connection failed: {}", e))?;
18
19 println!("✓ Connected successfully (encrypted)!");
20
21 // Test sending a simple command
22 use kitty_rc::command::CommandBuilder;
23
24 let cmd = CommandBuilder::new("ls")
25 .build();
26
27 match kitty.execute(&cmd).await {
28 Ok(response) => {
29 println!("✓ Encrypted command executed successfully!");
30 println!(" Response: {:?}", response);
31 }
32 Err(e) => {
33 eprintln!("✗ Encrypted command failed: {}", e);
34 if let Some(source) = Error::source(&e) {
35 eprintln!(" Error source: {}", source);
36 }
37 }
38 }
39
40 Ok(())
41}pub fn public_key(self, public_key: impl Into<String>) -> Self
Sourcepub async fn connect(self) -> Result<Kitty, KittyError>
pub async fn connect(self) -> Result<Kitty, KittyError>
Examples found in repository?
examples/test-simple-command.rs (line 7)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-101555.sock")
7 .connect()
8 .await?;
9
10 let cmd = CommandBuilder::new("ls").build();
11 let result = kitty.execute(&cmd).await;
12 println!("LS Result: {:?}", result);
13
14 Ok(())
15}More examples
examples/test-encrypted-simple.rs (line 8)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-101555.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 let cmd = CommandBuilder::new("ls").build();
12 let result = kitty.execute(&cmd).await;
13 println!("LS Result: {:?}", result);
14
15 Ok(())
16}examples/test-debug.rs (line 9)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 // Test without password
6 println!("=== Testing without password ===");
7 let mut kitty = Kitty::builder()
8 .socket_path("/run/user/1000/kitty-101555.sock")
9 .connect()
10 .await?;
11
12 let cmd = CommandBuilder::new("ls").build();
13 println!("Command: {:?}", cmd);
14 let result = kitty.execute(&cmd).await;
15 println!("Result: {:?}", result);
16
17 Ok(())
18}examples/test_font.rs (line 8)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut kitty = Kitty::builder()
6 .socket_path("/run/user/1000/kitty-757336.sock")
7 .password("0pD4cLsKze84eCYOh7dIlvMFF87rgHEPSkngVpgbtYJ9hAzJ")
8 .connect()
9 .await?;
10
11 println!("Testing set-font-size increment command...");
12
13 // Try increment
14 let cmd = SetFontSizeCommand::builder()
15 .size(0.0)
16 .increment_op("+".to_string())
17 .build()
18 .to_message()?;
19
20 let result = kitty.execute(&cmd).await?;
21 println!("Increment result: ok={}, data={:?}, error={:?}", result.ok, result.data, result.error);
22
23 Ok(())
24}examples/test-connectivity.rs (line 13)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 // Find kitty socket
6 let socket_path = find_kitty_socket()?;
7
8 println!("Connecting to: {}", socket_path);
9
10 // Test basic connection
11 let mut kitty = Kitty::builder()
12 .socket_path(&socket_path)
13 .connect()
14 .await
15 .map_err(|e| format!("Connection failed: {}", e))?;
16
17 println!("✓ Connected successfully!");
18
19 // Test sending a simple command
20 use kitty_rc::command::CommandBuilder;
21
22 let cmd = CommandBuilder::new("ls")
23 .build();
24
25 match kitty.execute(&cmd).await {
26 Ok(response) => {
27 println!("✓ Command executed successfully!");
28 if let Some(data) = response.data {
29 println!("Response: {}", data);
30 }
31 }
32 Err(e) => {
33 eprintln!("✗ Command failed: {}", e);
34 }
35 }
36
37 Ok(())
38}examples/test-encrypted.rs (line 15)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 // Find kitty socket
7 let socket_path = find_kitty_socket()?;
8
9 println!("Connecting to: {}", socket_path);
10
11 // Test encrypted connection
12 let mut kitty = Kitty::builder()
13 .socket_path(&socket_path)
14 .password(&read_password()?)
15 .connect()
16 .await
17 .map_err(|e| format!("Connection failed: {}", e))?;
18
19 println!("✓ Connected successfully (encrypted)!");
20
21 // Test sending a simple command
22 use kitty_rc::command::CommandBuilder;
23
24 let cmd = CommandBuilder::new("ls")
25 .build();
26
27 match kitty.execute(&cmd).await {
28 Ok(response) => {
29 println!("✓ Encrypted command executed successfully!");
30 println!(" Response: {:?}", response);
31 }
32 Err(e) => {
33 eprintln!("✗ Encrypted command failed: {}", e);
34 if let Some(source) = Error::source(&e) {
35 eprintln!(" Error source: {}", source);
36 }
37 }
38 }
39
40 Ok(())
41}Trait Implementations§
Auto Trait Implementations§
impl Freeze for KittyBuilder
impl RefUnwindSafe for KittyBuilder
impl Send for KittyBuilder
impl Sync for KittyBuilder
impl Unpin for KittyBuilder
impl UnwindSafe for KittyBuilder
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