@@ -2,7 +2,6 @@ use anyhow::Result;
22use core:: fmt;
33pub use events:: {
44 EventError , RRFuncArgVals , ResultEvent , Validate , common_events, component_events, core_events,
5- marker_events,
65} ;
76pub use io:: { RecordWriter , ReplayReader , from_replay_reader, to_record_writer} ;
87use serde:: { Deserialize , Serialize } ;
@@ -54,21 +53,28 @@ mod io;
5453/// Macro template for [`RREvent`] and its conversion to/from specific
5554/// event types
5655macro_rules! rr_event {
57- (
58- $(
59- $( #[ doc = $doc: literal] ) *
60- $variant: ident( $event: ty)
61- ) ,*
62- ) => (
56+ (
57+ $(
58+ $( #[ doc = $doc_np: literal] ) *
59+ $variant_no_payload: ident
60+ ) ,*
61+ ;
62+ $(
63+ $( #[ doc = $doc: literal] ) *
64+ $variant: ident( $event: ty)
65+ ) ,*
66+ ) => (
6367 /// A single, unified, low-level recording/replay event
6468 ///
6569 /// This type is the narrow waist for serialization/deserialization.
6670 /// Higher-level events (e.g. import calls consisting of lifts and lowers
6771 /// of parameter/return types) may drop down to one or more [`RREvent`]s
6872 #[ derive( Debug , Clone , Serialize , Deserialize ) ]
6973 pub enum RREvent {
70- /// Event signalling the end of a trace
71- Eof ,
74+ $(
75+ $( #[ doc = $doc_np] ) *
76+ $variant_no_payload,
77+ ) *
7278 $(
7379 $( #[ doc = $doc] ) *
7480 $variant( $event) ,
@@ -78,9 +84,11 @@ macro_rules! rr_event {
7884 impl fmt:: Display for RREvent {
7985 fn fmt( & self , f: & mut fmt:: Formatter <' _>) -> fmt:: Result {
8086 match self {
81- Self :: Eof => write!( f, "Eof event" ) ,
8287 $(
83- Self :: $variant( e) => write!( f, "{:?}" , e) ,
88+ Self :: $variant_no_payload => write!( f, "{}" , stringify!( $variant_no_payload) ) ,
89+ ) *
90+ $(
91+ Self :: $variant( payload) => write!( f, "{:?}" , payload) ,
8492 ) *
8593 }
8694 }
@@ -104,16 +112,25 @@ macro_rules! rr_event {
104112 }
105113 }
106114 ) *
107- ) ;
115+ ) ;
116+
108117}
109118
110119// Set of supported record/replay events
111120rr_event ! {
112- // Marker events
113121 /// Nop Event
114- Nop ( marker_events:: NopEvent ) ,
115- /// A custom message
116- CustomMessage ( marker_events:: CustomMessageEvent ) ,
122+ Nop ,
123+ /// Event signalling the end of a trace
124+ Eof
125+ ;
126+ /// The signature of the trace, enabling trace integrity during replay.
127+ ///
128+ /// This is always at the start of any valid trace.
129+ TraceSignature ( common_events:: TraceSignatureEvent ) ,
130+ /// A custom message in the trace, useful for diagnostics.
131+ ///
132+ /// Does not affect trace replay functionality
133+ CustomMessage ( common_events:: CustomMessageEvent ) ,
117134
118135 // Common events for both core or component wasm
119136 // REQUIRED events
@@ -172,11 +189,11 @@ rr_event! {
172189}
173190
174191impl RREvent {
175- /// Indicates whether current event is a marker event
192+ /// Indicates whether current event is a diagnostic event
176193 #[ inline]
177- pub fn is_marker ( & self ) -> bool {
194+ pub fn is_diagnostic ( & self ) -> bool {
178195 match self {
179- Self :: Nop ( _ ) | Self :: CustomMessage ( _) => true ,
196+ Self :: Nop | Self :: CustomMessage ( _) => true ,
180197 _ => false ,
181198 }
182199 }
0 commit comments