pub trait ProtocolObserver: Send {
// Required methods
fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str);
fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str);
fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize);
fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize);
fn on_choice(&mut self, decider: &str, branch: &str);
fn on_offer(&mut self, from: &str, branch: &str);
fn on_error(
&mut self,
protocol: &str,
role: &str,
error: &ChoreographyError,
);
fn on_complete(&mut self, protocol: &str, role: &str);
}Expand description
Trait for observing protocol execution events.
Implementations can log events, collect metrics, or control simulation behavior based on observed events.
Required Methods§
Sourcefn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str)
fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str)
Called when a protocol phase starts.
Sourcefn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str)
fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str)
Called when a protocol phase ends.
Sourcefn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
Called when a message is sent.
Sourcefn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
Called when a message is received.
Sourcefn on_choice(&mut self, decider: &str, branch: &str)
fn on_choice(&mut self, decider: &str, branch: &str)
Called when a choice is made (internal choice).
Sourcefn on_offer(&mut self, from: &str, branch: &str)
fn on_offer(&mut self, from: &str, branch: &str)
Called when a choice is received (external choice).
Sourcefn on_error(&mut self, protocol: &str, role: &str, error: &ChoreographyError)
fn on_error(&mut self, protocol: &str, role: &str, error: &ChoreographyError)
Called when an error occurs.
Sourcefn on_complete(&mut self, protocol: &str, role: &str)
fn on_complete(&mut self, protocol: &str, role: &str)
Called when the protocol completes successfully.