pub struct Response {
pub control: Vec<(char, String)>,
pub message: Option<String>,
}Expand description
Kitty graphics protocol APC (Application Programming Command) response.
See documentation.
Fields§
§control: Vec<(char, String)>Control codes.
message: Option<String>Message (“OK” or error).
Implementations§
Source§impl Response
impl Response
Sourcepub fn get_code_character(&self, code: char) -> Option<char>
pub fn get_code_character(&self, code: char) -> Option<char>
Get the value of a code as a character.
Sourcepub fn get_code_integer(&self, code: char) -> Option<i32>
pub fn get_code_integer(&self, code: char) -> Option<i32>
Get the value of a code as an integer.
Sourcepub fn is_ok(&self) -> bool
pub fn is_ok(&self) -> bool
Whether the message is “OK”.
Examples found in repository?
examples/response.rs (line 18)
3fn main() {
4 println!("Kitty supported: {}", Command::is_supported().expect("is_supported"));
5
6 // This query should always return OK
7
8 let response = Command::default()
9 // Action = query
10 .with_control('a', 'q')
11 // Image ID
12 .with_control('i', 1)
13 .with_expect_response()
14 .execute()
15 .expect("execute")
16 .expect("response");
17
18 if response.is_ok() {
19 println!("OK!");
20 }
21
22 // This command should always return an error
23
24 let response = Command::default()
25 // Image ID
26 .with_control('i', 1)
27 // Transmission medium = shared memory object
28 .with_control('t', 's')
29 .with_expect_response()
30 .execute_with_payload(b"not a shared memory object")
31 .expect("execute_with_payload")
32 .expect("response");
33
34 println!("Error: {}", response.message.expect("message"));
35}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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