1 | | | /// Base class to serialize/deserialize data of type [T] to a transferable type [S]. |
2 | | | abstract interface class SquadronMarshaler<T, S> { |
3 | | 0 | const SquadronMarshaler(); |
4 | | |
|
5 | | | /// Serialize [data] of type [T] to type [S], eg. a `String` or some binary representation. |
6 | | | /// `unmarshal(marshal(data))` must produce an instance of [T] that is equivalent to |
7 | | | /// original instance [data]. |
8 | | | S marshal(T data); |
9 | | |
|
10 | | | /// Deserialize a representation of type [S] back to the original data of type [T]. |
11 | | | /// `unmarshal(marshal(data))` must produce an instance of [T] that is equivalent to |
12 | | | /// original instance [data]. |
13 | | | T unmarshal(S data); |
14 | | | } |