lighthouse-pulse/lighthouse/state/shard_and_committee.rs

30 lines
585 B
Rust
Raw Normal View History

2018-08-28 07:51:57 +00:00
#[derive(Clone,Debug)]
2018-08-10 00:48:03 +00:00
pub struct ShardAndCommittee {
2018-08-16 04:17:28 +00:00
pub shard_id: u16,
2018-08-28 07:51:57 +00:00
pub committee: Vec<usize>
2018-08-10 00:48:03 +00:00
}
impl ShardAndCommittee {
/// Returns a new instance where the `shard_id` is zero and the
/// committee is an empty vector.
pub fn zero() -> Self {
Self {
shard_id: 0,
committee: vec![],
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_shard_and_committee_zero() {
2018-08-10 01:22:15 +00:00
let s = ShardAndCommittee::zero();
2018-08-10 00:48:03 +00:00
assert_eq!(s.shard_id, 0);
assert_eq!(s.committee.len(), 0);
}
}