pub trait TokenDecoder<T: TokenType>: Send + Sync {
// Required method
fn try_decode_to_bytes(
&self,
tokens: &[T],
) -> WCResult<DecodeResult<Vec<u8>>>;
// Provided methods
fn try_decode_batch_to_bytes(
&self,
batch: &[&[T]],
) -> WCResult<BatchDecodeResult<Vec<u8>>> { ... }
fn try_decode_to_string(
&self,
tokens: &[T],
) -> WCResult<DecodeResult<String>> { ... }
fn try_decode_batch_to_strings(
&self,
batch: &[&[T]],
) -> WCResult<BatchDecodeResult<String>> { ... }
}Expand description
The common trait for &[T] -> Vec<u8>/String> decoders.
§Style Hints
When there is no local ambiguity with other decoders,
instance names for implementing types should prefer decoder;
and use the preferred name for the implementing type
when there is conflict with other encoders.