pub fn new(socket: S) -> Result<Client<S>> {
        let mut socket = BufStream::new(socket);

        let mut banner = String::new();
        socket.read_line(&mut banner)?;

        if !banner.starts_with("OK MPD ") {
            return Err(From::from(ProtoError::BadBanner));
        }

        let version = banner[7..].trim().parse::<Version>()?;

        Ok(Client {
               socket: socket,
               version: version,
           })
    }
// Constructors {{{
/// Create client from some arbitrary pre-connected socket
Constructors {{{
Create client from some arbitrary pre-connected socket
Constructors {{{ Create client from some arbitrary pre - connected socket
pub fn new(socket: S) -> Result<Client<S>> {
        let mut socket = BufStream::new(socket);
        let mut banner = String::new();
        socket.read_line(&mut banner)?;
        if !banner.starts_with("OK MPD ") {
            return Err(From::from(ProtoError::BadBanner));
        }
        let version = banner[7..].trim().parse::<Version>()?;
        Ok(Client {
               socket: socket,
               version: version,
           })
    }
pub fn new ( socket : S ) -> Result < Client < S > > { let mut socket = BufStream :: new ( socket ) ; let mut banner = String :: new ( ) ; socket . read_line ( & mut banner ) ? ; if ! banner . starts_with ( " " ) { return Err ( From :: from ( ProtoError :: BadBanner ) ) ; } let version = banner [ 7 .. ] . trim ( ) . parse :: < Version > ( ) ? ; Ok ( Client { socket : socket , version : version , } ) }
Constructors {{{
Create client from some arbitrary pre-connected socket
Constructors {{{ Create client from some arbitrary pre - connected socket
socket
S