Struct CommandServer

Source
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: Connection

A handle on the spawned process.

§capabilities: Vec<String>

The list of capabilities the server reported on startup.

§encoding: String

The character encoding the server reported on startup.

Implementations§

Source§

impl CommandServer

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.