Struct common_types::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]
impl StateDiff
pub fn get(&self) -> &BTreeMap<Address, AccountDiff>
[src]
pub fn get(&self) -> &BTreeMap<Address, AccountDiff>
Get the actual data.
Methods from Deref<Target = BTreeMap<Address, AccountDiff>>
pub fn get<Q>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Ord + ?Sized,
1.0.0[src]
pub fn get<Q>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Ord + ?Sized,
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);
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)> where
K: Borrow<Q>,
Q: Ord + ?Sized,
[src]
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)> where
K: Borrow<Q>,
Q: Ord + ?Sized,
map_get_key_value
)Returns the key-value pair corresponding to the supplied key.
The supplied 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
#![feature(map_get_key_value)] use std::collections::BTreeMap; let mut map = BTreeMap::new(); map.insert(1, "a"); assert_eq!(map.get_key_value(&1), Some((&1, &"a"))); assert_eq!(map.get_key_value(&2), None);
pub fn contains_key<Q>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Ord + ?Sized,
1.0.0[src]
pub fn contains_key<Q>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Ord + ?Sized,
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);
ⓘImportant traits for Range<'a, K, V>pub fn range<T, R>(&self, range: R) -> Range<K, V> where
K: Borrow<T>,
R: RangeBounds<T>,
T: Ord + ?Sized,
1.17.0[src]
pub fn range<T, R>(&self, range: R) -> Range<K, V> where
K: Borrow<T>,
R: RangeBounds<T>,
T: Ord + ?Sized,
Constructs a double-ended iterator over a sub-range of elements in the map.
The simplest way is to use the range syntax min..max
, thus range(min..max)
will
yield elements from min (inclusive) to max (exclusive).
The range may also be entered as (Bound<T>, Bound<T>)
, so for example
range((Excluded(4), Included(10)))
will yield a left-exclusive, right-inclusive
range from 4 to 10.
Panics
Panics if range start > end
.
Panics if range start == end
and both bounds are Excluded
.
Examples
Basic usage:
use std::collections::BTreeMap; use std::ops::Bound::Included; 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(4..).next());
ⓘImportant traits for Iter<'a, K, V>pub fn iter(&self) -> Iter<K, V>
1.0.0[src]
pub fn iter(&self) -> Iter<K, V>
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"));
ⓘImportant traits for Keys<'a, K, V>pub fn keys(&'a self) -> Keys<'a, K, V>
1.0.0[src]
pub fn keys(&'a self) -> Keys<'a, K, V>
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]);
ⓘImportant traits for Values<'a, K, V>pub fn values(&'a self) -> Values<'a, K, V>
1.0.0[src]
pub fn values(&'a self) -> Values<'a, K, V>
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"]);
pub fn len(&self) -> usize
1.0.0[src]
pub fn len(&self) -> usize
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);
pub fn is_empty(&self) -> bool
1.0.0[src]
pub fn is_empty(&self) -> bool
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 Debug for StateDiff
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for StateDiff
[src]
impl PartialEq for StateDiff
fn eq(&self, other: &StateDiff) -> bool
[src]
fn eq(&self, other: &StateDiff) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &StateDiff) -> bool
[src]
fn ne(&self, other: &StateDiff) -> bool
This method tests for !=
.
impl Eq for StateDiff
[src]
impl Eq for StateDiff
impl Clone for StateDiff
[src]
impl Clone for StateDiff
fn clone(&self) -> StateDiff
[src]
fn clone(&self) -> StateDiff
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Display for StateDiff
[src]
impl Display for StateDiff
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Deref for StateDiff
[src]
impl Deref for StateDiff