1use crate::{Tr, TrArgs, TrDyn, TrRich};
5use mf2_runtime::{ErrorSink, Formatter, PartSink, Sink};
6
7pub trait Message {
9 fn write(&self, f: &Formatter<'_>, out: &mut dyn Sink, errs: &mut dyn ErrorSink);
11
12 fn parts(&self, f: &Formatter<'_>, out: &mut dyn PartSink, errs: &mut dyn ErrorSink);
14}
15
16impl Message for Tr {
17 fn write(&self, f: &Formatter<'_>, out: &mut dyn Sink, errs: &mut dyn ErrorSink) {
18 Tr::write(*self, f, out, errs);
19 }
20
21 fn parts(&self, f: &Formatter<'_>, out: &mut dyn PartSink, errs: &mut dyn ErrorSink) {
22 Tr::parts(*self, f, out, errs);
23 }
24}
25
26impl Message for TrArgs {
27 fn write(&self, f: &Formatter<'_>, out: &mut dyn Sink, errs: &mut dyn ErrorSink) {
28 TrArgs::write(self, f, out, errs);
29 }
30
31 fn parts(&self, f: &Formatter<'_>, out: &mut dyn PartSink, errs: &mut dyn ErrorSink) {
32 TrArgs::parts(self, f, out, errs);
33 }
34}
35
36impl Message for TrRich {
37 fn write(&self, f: &Formatter<'_>, out: &mut dyn Sink, errs: &mut dyn ErrorSink) {
38 TrRich::write(self, f, out, errs);
39 }
40
41 fn parts(&self, f: &Formatter<'_>, out: &mut dyn PartSink, errs: &mut dyn ErrorSink) {
42 TrRich::parts(self, f, out, errs);
43 }
44}
45
46impl Message for TrDyn {
47 fn write(&self, f: &Formatter<'_>, out: &mut dyn Sink, errs: &mut dyn ErrorSink) {
48 TrDyn::write(self, f, out, errs);
49 }
50
51 fn parts(&self, f: &Formatter<'_>, out: &mut dyn PartSink, errs: &mut dyn ErrorSink) {
52 TrDyn::parts(self, f, out, errs);
53 }
54}