radix_transactions/model/preparation/
summary.rs1use crate::internal_prelude::*;
2
3#[derive(Debug, Clone, Eq, PartialEq)]
5pub struct Summary {
6 pub effective_length: usize,
10 pub total_bytes_hashed: usize,
12 pub hash: Hash,
15}
16
17pub trait HasSummary {
18 fn get_summary(&self) -> &Summary;
19 fn summary_mut(&mut self) -> &mut Summary;
20}
21
22macro_rules! impl_has_summary {
23 (
24 $(< $( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? $( = $deflt:tt)? ),+ >)?
25 $prepared:ident
26 $(< $($rt:tt),+ >)?
27 ) => {
28 #[allow(deprecated)]
29 impl
30 $(< $( $lt $( : $clt $(+ $dlt )* )? $( = $deflt)? ),+ >)?
31 HasSummary for $prepared
32 $(< $( $rt ),+ >)?
33 {
34 fn get_summary(&self) -> &Summary {
35 &self.summary
36 }
37
38 fn summary_mut(&mut self) -> &mut Summary {
39 &mut self.summary
40 }
41 }
42 };
43}
44
45pub(crate) use impl_has_summary;