pub struct PeersObservation {
pub attached: usize,
pub detached: usize,
pub announced: usize,
}Expand description
The peer board’s tally, when somebody asked it.
use majordomus_cli::environment::preflight::{derive, Observations, PeersObservation, Verdict};
let mut o = Observations::empty("demo", 0);
o.peers = Ok(PeersObservation { attached: 3, detached: 1, announced: 2 });
let p = derive(&o);
assert_eq!(p.check("integration.peers").unwrap().verdict, Verdict::Active);
assert!(p.check("integration.peers").unwrap().summary.starts_with("3 attached"));Fields§
§attached: usizePeers attached now.
detached: usizePeers gone whose claims the board still shows.
announced: usizeAttached peers that announced what they are doing.
Implementations§
Source§impl PeersObservation
impl PeersObservation
Sourcepub fn of(peers: &[Peer]) -> Self
pub fn of(peers: &[Peer]) -> Self
The tally of a board’s peers: the same count whether the board was asked over the loopback address or read in the process that holds it.
use majordomus_cli::environment::preflight::PeersObservation;
use majordomus_cli::peers::{PeerBoard, Transport};
let board = PeerBoard::new();
let a = board.attach(Transport::Http);
board.announce(&a, "writing docs", vec!["docs".into()]);
board.attach(Transport::Stdio);
let t = PeersObservation::of(&board.list());
assert_eq!((t.attached, t.announced, t.detached), (2, 1, 0));Trait Implementations§
Source§impl Clone for PeersObservation
impl Clone for PeersObservation
Source§fn clone(&self) -> PeersObservation
fn clone(&self) -> PeersObservation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeersObservation
impl Debug for PeersObservation
Source§impl Default for PeersObservation
impl Default for PeersObservation
Source§fn default() -> PeersObservation
fn default() -> PeersObservation
Returns the “default value” for a type. Read more
impl Eq for PeersObservation
Source§impl PartialEq for PeersObservation
impl PartialEq for PeersObservation
Source§fn eq(&self, other: &PeersObservation) -> bool
fn eq(&self, other: &PeersObservation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PeersObservation
Auto Trait Implementations§
impl Freeze for PeersObservation
impl RefUnwindSafe for PeersObservation
impl Send for PeersObservation
impl Sync for PeersObservation
impl Unpin for PeersObservation
impl UnsafeUnpin for PeersObservation
impl UnwindSafe for PeersObservation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.