pub struct CommandServer {
pub connection: Connection,
pub capabilities: Vec<String>,
pub encoding: String,
}Expand description
Spawns and communicates with a command server process.
Fields§
§connection: ConnectionA handle on the spawned process.
capabilities: Vec<String>The list of capabilities the server reported on startup.
encoding: StringThe character encoding the server reported on startup.
Implementations§
Source§impl CommandServer
impl CommandServer
Sourcepub fn new() -> Result<CommandServer>
pub fn new() -> Result<CommandServer>
Constructs and starts up a command server instance, or returns an error.
Examples found in repository?
examples/client.rs (line 26)
25fn main() {
26 let mut cmdserver = CommandServer::new().ok().expect("failed to start command server");
27 println!("capabilities: {:?}", cmdserver.capabilities);
28 println!("encoding: {:?}", cmdserver.encoding);
29
30 let (result, output, error) =
31 run_command(&mut cmdserver, vec![b"log", b"-l", b"5"]);
32 cmdserver.connection.close().ok().expect("command server did not stop cleanly");
33
34 println!("output: {}",
35 String::from_utf8(output).unwrap().trim_right_matches('\n'));
36 println!("error: {}",
37 String::from_utf8(error).unwrap().trim_right_matches('\n'));
38 println!("result: {:?}", result);
39}Auto Trait Implementations§
impl Freeze for CommandServer
impl RefUnwindSafe for CommandServer
impl Send for CommandServer
impl Sync for CommandServer
impl Unpin for CommandServer
impl UnwindSafe for CommandServer
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