Struct ethcore::state_diff::StateDiff
[−]
[src]
pub struct StateDiff { pub raw: BTreeMap<Address, AccountDiff>, }
Expression for the delta between two system states. Encoded the delta of every altered account.
Fields
raw: BTreeMap<Address, AccountDiff>
Raw diff key-value
Methods
impl StateDiff
[src]
fn get(&self) -> &BTreeMap<Address, AccountDiff>
Get the actual data.
Methods from Deref<Target=BTreeMap<Address, AccountDiff>>
fn get<Q>(&self, key: &Q) -> Option<&V> where K: Borrow<Q>, Q: Ord + ?Sized
1.0.0
Returns a reference to the value corresponding to the key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
Examples
Basic usage:
use std::collections::BTreeMap; let mut map = BTreeMap::new(); map.insert(1, "a"); assert_eq!(map.get(&1), Some(&"a")); assert_eq!(map.get(&2), None);
fn contains_key<Q>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: Ord + ?Sized
1.0.0
Returns true if the map contains a value for the specified key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
Examples
Basic usage:
use std::collections::BTreeMap; let mut map = BTreeMap::new(); map.insert(1, "a"); assert_eq!(map.contains_key(&1), true); assert_eq!(map.contains_key(&2), false);
fn range<Min, Max>(&self, min: Bound<&Min>, max: Bound<&Max>) -> Range<K, V> where K: Borrow<Min> + Borrow<Max>, Max: Ord + ?Sized, Min: Ord + ?Sized
btree_range
): matches collection reform specification, waiting for dust to settle
Constructs a double-ended iterator over a sub-range of elements in the map, starting
at min, and ending at max. If min is Unbounded
, then it will be treated as "negative
infinity", and if max is Unbounded
, then it will be treated as "positive infinity".
Thus range(Unbounded, Unbounded) will yield the whole collection.
Examples
Basic usage:
#![feature(btree_range, collections_bound)] use std::collections::BTreeMap; use std::collections::Bound::{Included, Unbounded}; let mut map = BTreeMap::new(); map.insert(3, "a"); map.insert(5, "b"); map.insert(8, "c"); for (&key, &value) in map.range(Included(&4), Included(&8)) { println!("{}: {}", key, value); } assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next());
fn iter(&self) -> Iter<K, V>
1.0.0
Gets an iterator over the entries of the map, sorted by key.
Examples
Basic usage:
use std::collections::BTreeMap; let mut map = BTreeMap::new(); map.insert(3, "c"); map.insert(2, "b"); map.insert(1, "a"); for (key, value) in map.iter() { println!("{}: {}", key, value); } let (first_key, first_value) = map.iter().next().unwrap(); assert_eq!((*first_key, *first_value), (1, "a"));
fn keys(&'a self) -> Keys<'a, K, V>
1.0.0
Gets an iterator over the keys of the map, in sorted order.
Examples
Basic usage:
use std::collections::BTreeMap; let mut a = BTreeMap::new(); a.insert(2, "b"); a.insert(1, "a"); let keys: Vec<_> = a.keys().cloned().collect(); assert_eq!(keys, [1, 2]);
fn values(&'a self) -> Values<'a, K, V>
1.0.0
Gets an iterator over the values of the map, in order by key.
Examples
Basic usage:
use std::collections::BTreeMap; let mut a = BTreeMap::new(); a.insert(1, "hello"); a.insert(2, "goodbye"); let values: Vec<&str> = a.values().cloned().collect(); assert_eq!(values, ["hello", "goodbye"]);
fn len(&self) -> usize
1.0.0
Returns the number of elements in the map.
Examples
Basic usage:
use std::collections::BTreeMap; let mut a = BTreeMap::new(); assert_eq!(a.len(), 0); a.insert(1, "a"); assert_eq!(a.len(), 1);
fn is_empty(&self) -> bool
1.0.0
Returns true if the map contains no elements.
Examples
Basic usage:
use std::collections::BTreeMap; let mut a = BTreeMap::new(); assert!(a.is_empty()); a.insert(1, "a"); assert!(!a.is_empty());
Trait Implementations
impl Debug for StateDiff
[src]
impl PartialEq for StateDiff
[src]
fn eq(&self, __arg_0: &StateDiff) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &StateDiff) -> bool
This method tests for !=
.
impl Eq for StateDiff
[src]
impl Clone for StateDiff
[src]
fn clone(&self) -> StateDiff
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Display for StateDiff
[src]
impl Deref for StateDiff
[src]
type Target = BTreeMap<Address, AccountDiff>
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value