haystack_core/codecs/trio/
mod.rs1mod encoder;
5mod parser;
6
7pub use encoder::encode_grid;
8pub use parser::decode_grid;
9
10use super::{Codec, CodecError};
11use crate::data::HGrid;
12use crate::kinds::Kind;
13
14pub struct TrioCodec;
16
17impl Codec for TrioCodec {
18 fn mime_type(&self) -> &str {
19 "text/trio"
20 }
21
22 fn encode_grid(&self, grid: &HGrid) -> Result<String, CodecError> {
23 encode_grid(grid)
24 }
25
26 fn decode_grid(&self, input: &str) -> Result<HGrid, CodecError> {
27 decode_grid(input)
28 }
29
30 fn encode_scalar(&self, val: &Kind) -> Result<String, CodecError> {
31 super::zinc::encode_scalar(val)
33 }
34
35 fn decode_scalar(&self, input: &str) -> Result<Kind, CodecError> {
36 super::zinc::decode_scalar(input)
38 }
39}