qubit_codec/transcode/transcode_converter.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Semantic marker trait for buffered converters.
9
10use super::{
11 TranscodeConvertError,
12 Transcoder,
13};
14
15/// Converts encoded units of one representation into encoded units of another.
16///
17/// `TranscodeConverter` refines [`Transcoder`] for implementations whose
18/// input and output are both encoded unit streams. Any intermediate logical
19/// values are implementation details of the concrete converter.
20///
21/// The trait adds no methods. It exists to make generic bounds distinguish
22/// unit-to-unit conversion from value-to-unit encoding and unit-to-value
23/// decoding.
24pub trait TranscodeConverter:
25 Transcoder<
26 Error = TranscodeConvertError<
27 Self::DecodeError,
28 Self::EncodeError,
29 Self::Value,
30 >,
31>
32{
33 /// Domain error type produced by source decoding.
34 type DecodeError;
35
36 /// Domain error type produced by target encoding.
37 type EncodeError;
38
39 /// Intermediate logical value type converted between source and target.
40 type Value;
41}