pub trait Codec: Send + Sync {
// Required methods
fn mime_type(&self) -> &str;
fn encode_grid(&self, grid: &HGrid) -> Result<String, CodecError>;
fn decode_grid(&self, input: &str) -> Result<HGrid, CodecError>;
fn encode_scalar(&self, val: &Kind) -> Result<String, CodecError>;
fn decode_scalar(&self, input: &str) -> Result<Kind, CodecError>;
}Expand description
Trait for Haystack wire format codecs.
Required Methods§
Sourcefn encode_grid(&self, grid: &HGrid) -> Result<String, CodecError>
fn encode_grid(&self, grid: &HGrid) -> Result<String, CodecError>
Encode an HGrid to a string.
Sourcefn decode_grid(&self, input: &str) -> Result<HGrid, CodecError>
fn decode_grid(&self, input: &str) -> Result<HGrid, CodecError>
Decode a string to an HGrid.
Sourcefn encode_scalar(&self, val: &Kind) -> Result<String, CodecError>
fn encode_scalar(&self, val: &Kind) -> Result<String, CodecError>
Encode a single scalar Kind value to a string.
Sourcefn decode_scalar(&self, input: &str) -> Result<Kind, CodecError>
fn decode_scalar(&self, input: &str) -> Result<Kind, CodecError>
Decode a string to a single scalar Kind value.