pub fn as_tx<'a>(&'a self) -> DbResult<Transaction<'a>> {

        let mut de_tx = Deserializer::new(&self.buffer);
        let mut de_sigs = Deserializer::new(&self.sigs);

        let input_count: u32  = de_tx.deserialize()?;
        let output_count: u32 = de_tx.deserialize()?;
        let sig_ptr: ValuePtr = de_tx.deserialize()?;

        let prev_outs: Vec<Record> = try!((0..input_count).map(|_|
            de_tx.deserialize()).collect());

        let txs_in: Result<Vec<_>,DbError> = prev_outs.iter().map(|rec|
            Ok(transaction::TxInput {
                script:          de_sigs.deserialize().map_err(DbError::from)?,
                sequence:        de_sigs.deserialize().map_err(DbError::from)?,
                prev_tx_out:     de_tx.deserialize().map_err(DbError::from)?,
                prev_tx_out_idx: rec.get_output_index()
            })
        ).collect();

        let txs_out: Result<Vec<_>,DbError>  = (0..output_count).map(|_|
            Ok(transaction::TxOutput {
                value:     de_tx.deserialize().map_err(DbError::from)?,
                pk_script: de_tx.deserialize().map_err(DbError::from)?,
            })
        ).collect();

        Ok(Transaction {
            version: de_tx.deserialize()?,
            txs_in:  txs_in?,
            txs_out: txs_out?,
            lock_time: de_tx.deserialize()?
        })

    }
/// Parses the db-format buffer as a transaction
Parses the db-format buffer as a transaction
Parses the db - format buffer as a transaction
pub fn as_tx<'a>(&'a self) -> DbResult<Transaction<'a>> {
        let mut de_tx = Deserializer::new(&self.buffer);
        let mut de_sigs = Deserializer::new(&self.sigs);
        let input_count: u32  = de_tx.deserialize()?;
        let output_count: u32 = de_tx.deserialize()?;
        let sig_ptr: ValuePtr = de_tx.deserialize()?;
        let prev_outs: Vec<Record> = try!((0..input_count).map(|_|
            de_tx.deserialize()).collect());
        let txs_in: Result<Vec<_>,DbError> = prev_outs.iter().map(|rec|
            Ok(transaction::TxInput {
                script:          de_sigs.deserialize().map_err(DbError::from)?,
                sequence:        de_sigs.deserialize().map_err(DbError::from)?,
                prev_tx_out:     de_tx.deserialize().map_err(DbError::from)?,
                prev_tx_out_idx: rec.get_output_index()
            })
        ).collect();
        let txs_out: Result<Vec<_>,DbError>  = (0..output_count).map(|_|
            Ok(transaction::TxOutput {
                value:     de_tx.deserialize().map_err(DbError::from)?,
                pk_script: de_tx.deserialize().map_err(DbError::from)?,
            })
        ).collect();
        Ok(Transaction {
            version: de_tx.deserialize()?,
            txs_in:  txs_in?,
            txs_out: txs_out?,
            lock_time: de_tx.deserialize()?
        })
    }
pub fn as_tx < ' a > ( & ' a self ) -> DbResult < Transaction < ' a > > { let mut de_tx = Deserializer :: new ( & self . buffer ) ; let mut de_sigs = Deserializer :: new ( & self . sigs ) ; let input_count : u32 = de_tx . deserialize ( ) ? ; let output_count : u32 = de_tx . deserialize ( ) ? ; let sig_ptr : ValuePtr = de_tx . deserialize ( ) ? ; let prev_outs : Vec < Record > = try ! ( ( 0 input_count ) map ( de_tx deserialize ( ) ) collect ( ) ) ; let txs_in : Result < Vec < _ > , DbError > = prev_outs . iter ( ) . map ( | rec | Ok ( transaction :: TxInput { script : de_sigs . deserialize ( ) . map_err ( DbError :: from ) ? , sequence : de_sigs . deserialize ( ) . map_err ( DbError :: from ) ? , prev_tx_out : de_tx . deserialize ( ) . map_err ( DbError :: from ) ? , prev_tx_out_idx : rec . get_output_index ( ) } ) ) . collect ( ) ; let txs_out : Result < Vec < _ > , DbError > = ( 0 .. output_count ) . map ( | _ | Ok ( transaction :: TxOutput { value : de_tx . deserialize ( ) . map_err ( DbError :: from ) ? , pk_script : de_tx . deserialize ( ) . map_err ( DbError :: from ) ? , } ) ) . collect ( ) ; Ok ( Transaction { version : de_tx . deserialize ( ) ? , txs_in : txs_in ? , txs_out : txs_out ? , lock_time : de_tx . deserialize ( ) ? } ) }
Parses the db-format buffer as a transaction
Parses the db - format buffer as a transaction
&'a self
&'a self