pub fn to_binary<W: Write>(&self, input: W) -> Result<()> {
        let mut bw = BufWriter::new(input);

        // Output the binary
        for &w in &self.memory[..self.len] {
            // The IBCM is big-endian, but output should be
            // little-endian for compatibility with the reference
            // implementation (which does not support big-endian
            // output).
            bw.write(&[(w & 0xff) as u8, ((w >> 8) & 0xff) as u8])
                .chain_err(|| ErrorKind::Io("could not write to file".into()))?;
        }

        Ok(())
    }
/// Writes the memory of the simulator in binary format.
///
/// # Examples
///
/// ```
/// use ibcm::Simulator;
///
/// let mut output = Vec::new();
/// {
///     let sim = Simulator::from_instructions(&[0x1000, 0x1800, 0x0000]).unwrap();
///     sim.to_binary(&mut output).unwrap();
/// }
///
/// assert_eq!(&[0x00, 0x10, 0x00, 0x18, 0x00, 0x00], output.as_slice());
/// ```
Writes the memory of the simulator in binary format.
Writes the memory of the simulator in binary format .
pub fn to_binary<W: Write>(&self, input: W) -> Result<()> {
        let mut bw = BufWriter::new(input);
        // Output the binary
        for &w in &self.memory[..self.len] {
            // The IBCM is big-endian, but output should be
            // little-endian for compatibility with the reference
            // implementation (which does not support big-endian
            // output).
            bw.write(&[(w & 0xff) as u8, ((w >> 8) & 0xff) as u8])
                .chain_err(|| ErrorKind::Io("could not write to file".into()))?;
        }
        Ok(())
    }
pub fn to_binary < W : Write > ( & self , input : W ) -> Result < ( ) > { let mut bw = BufWriter :: new ( input ) ; // Output the binary for & w in & self . memory [ .. self . len ] { // The IBCM is big-endian, but output should be // little-endian for compatibility with the reference // implementation (which does not support big-endian // output). bw . write ( & [ ( w & 0xff ) as u8 , ( ( w >> 8 ) & 0xff ) as u8 ] ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; } Ok ( ( ) ) }
Writes the memory of the simulator in binary format.
Writes the memory of the simulator in binary format .
&self
input
W
&self
input
W
examples
```
use ibcm::Simulator.




` ` ` use ibcm :: Simulator .