fn download(&mut self, data: &[u8]) -> FbResult<()> {
        // Wrapped in block to drop len as soon as possible
        let cmd = {
            let mut cmd = Vec::with_capacity(DOWNLOAD_CMD.len() + 8);
            let mut len = format!("{:08x}", data.len()).into_bytes();
            cmd.extend_from_slice(DOWNLOAD_CMD);
            cmd.append(&mut len);
            cmd
        };
        let reply = fb_send(self, &cmd)?;

        match reply {
            Reply::DATA(size) if size == data.len() => {
                let reply = fb_send(self, data)?;
                match reply {
                    Reply::OKAY(_) => Ok(()),
                    Reply::FAIL(message) => Err(message),
                    _ => Err("Unknown failure".to_owned()),
                }
            }
            Reply::FAIL(message) => Err(message),
            _ => Err("Unknown failure".to_owned()),
        }
    }
/// Downloads provided data into a client.
Downloads provided data into a client.
Downloads provided data into a client .
fn download(&mut self, data: &[u8]) -> FbResult<()> {
        // Wrapped in block to drop len as soon as possible
        let cmd = {
            let mut cmd = Vec::with_capacity(DOWNLOAD_CMD.len() + 8);
            let mut len = format!("{:08x}", data.len()).into_bytes();
            cmd.extend_from_slice(DOWNLOAD_CMD);
            cmd.append(&mut len);
            cmd
        };
        let reply = fb_send(self, &cmd)?;
        match reply {
            Reply::DATA(size) if size == data.len() => {
                let reply = fb_send(self, data)?;
                match reply {
                    Reply::OKAY(_) => Ok(()),
                    Reply::FAIL(message) => Err(message),
                    _ => Err("Unknown failure".to_owned()),
                }
            }
            Reply::FAIL(message) => Err(message),
            _ => Err("Unknown failure".to_owned()),
        }
    }
fn download ( & mut self , data : & [ u8 ] ) -> FbResult < ( ) > { // Wrapped in block to drop len as soon as possible let cmd = { let mut cmd = Vec :: with_capacity ( DOWNLOAD_CMD . len ( ) + 8 ) ; let mut len = format ! ( " " data len ( ) ) . into_bytes ( ) ; cmd . extend_from_slice ( DOWNLOAD_CMD ) ; cmd . append ( & mut len ) ; cmd } ; let reply = fb_send ( self , & cmd ) ? ; match reply { Reply :: DATA ( size ) if size == data . len ( ) => { let reply = fb_send ( self , data ) ? ; match reply { Reply :: OKAY ( _ ) => Ok ( ( ) ) , Reply :: FAIL ( message ) => Err ( message ) , _ => Err ( " " . to_owned ( ) ) , } } Reply :: FAIL ( message ) => Err ( message ) , _ => Err ( " " . to_owned ( ) ) , } }
Downloads provided data into a client.
Downloads provided data into a client .
&mut self
data
&[u8]