      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
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106

    use bloomchain::Bloom;
    use bloomchain::group::{BloomGroup, GroupPosition};
    use rlp::*;
    use basic_types::LogBloom;

    /// Helper structure representing bloom of the trace.
    #[derive(Clone)]
    pub struct BlockTracesBloom(LogBloom);

    impl From<LogBloom> for BlockTracesBloom {
    	fn from(bloom: LogBloom) -> BlockTracesBloom {
    		BlockTracesBloom(bloom)
    	}
    }

    impl From<Bloom> for BlockTracesBloom {
    	fn from(bloom: Bloom) -> BlockTracesBloom {
    		let bytes: [u8; 256] = bloom.into();
    		BlockTracesBloom(LogBloom::from(bytes))
    	}
    }

    impl Into<Bloom> for BlockTracesBloom {
    	fn into(self) -> Bloom {
    		let log = self.0;
    		Bloom::from(log.0)
    	}
    }

    /// Represents group of X consecutive blooms.
    #[derive(Clone)]
    pub struct BlockTracesBloomGroup {
    	blooms: Vec<BlockTracesBloom>,
    }

    impl From<BloomGroup> for BlockTracesBloomGroup {
    	fn from(group: BloomGroup) -> Self {
    		let blooms = group.blooms
    			.into_iter()
    			.map(From::from)
    			.collect();

    		BlockTracesBloomGroup {
    			blooms: blooms
    		}
    	}
    }

    impl Into<BloomGroup> for BlockTracesBloomGroup {
    	fn into(self) -> BloomGroup {
    		let blooms = self.blooms
    			.into_iter()
    			.map(Into::into)
    			.collect();

    		BloomGroup {
    			blooms: blooms
    		}
    	}
    }

    impl Decodable for BlockTracesBloom {
    	fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
    		Decodable::decode(decoder).map(BlockTracesBloom)
    	}
    }

    impl Encodable for BlockTracesBloom {
    	fn rlp_append(&self, s: &mut RlpStream) {
    		Encodable::rlp_append(&self.0, s)
    	}
    }

    impl Decodable for BlockTracesBloomGroup {
    	fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
    		let blooms = Decodable::decode(decoder)?;
    		let group = BlockTracesBloomGroup {
    			blooms: blooms
    		};
    		Ok(group)
    	}
    }

    impl Encodable for BlockTracesBloomGroup {
    	fn rlp_append(&self, s: &mut RlpStream) {
    		Encodable::rlp_append(&self.blooms, s)
    	}
    }

    /// Represents `BloomGroup` position in database.
    #[derive(PartialEq, Eq, Hash, Clone, Debug)]
    pub struct TraceGroupPosition {
    	/// Bloom level.
    	pub level: u8,
    	/// Group index.
    	pub index: u32,
    }

    impl From<GroupPosition> for TraceGroupPosition {
    	fn from(p: GroupPosition) -> Self {
    		TraceGroupPosition {
    			level: p.level as u8,
    			index: p.index as u32,
    		}
    	}
    }

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)