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::TranscodeConvertError;
11use super::Transcoder;
12
13/// Converts encoded units of one representation into encoded units of another.
14///
15/// `TranscodeConverter` refines [`Transcoder`] for implementations whose
16/// input and output are both encoded unit streams. Any intermediate logical
17/// values are implementation details of the concrete converter.
18///
19/// The trait adds no methods. It exists to make generic bounds distinguish
20/// unit-to-unit conversion from value-to-unit encoding and unit-to-value
21/// decoding.
22pub trait TranscodeConverter:
23 Transcoder<Error = TranscodeConvertError<Self::DecodeError, Self::EncodeError, Self::Value>>
24{
25 /// Domain error type produced by source decoding.
26 type DecodeError;
27
28 /// Domain error type produced by target encoding.
29 type EncodeError;
30
31 /// Intermediate logical value type converted between source and target.
32 type Value;
33}