1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! A client which sends commands to way cooler

use std::convert::AsRef;
use std::path::Path;
use std::io::{Read, Write};
use std::io::Result as IOResult;
use std::io::Error as IOError;

use client::SocketClient;
use message::{Command, CommandResult};

/// Represents a client which can be used to send commands
pub struct CommandClient(SocketClient);

impl CommandClient {
    /// Connect this client to a socket at the given path
    pub fn connect<P: AsRef<Path>>(path: P) -> IOResult<CommandClient> {
        SocketClient::connect(path).map(|s| CommandClient(s))
    }

    /// Sends a commmand to IPC and returns the result.
    pub fn send(command: Command) -> CommandResult {
        unimplemented!()
    }
}