qubit_codec/transcode/transcode_decoder.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 decoders.
9
10use super::TranscodeDecodeError;
11use super::Transcoder;
12
13/// Decodes encoded units into logical values over caller-provided buffers.
14///
15/// `TranscodeDecoder` refines [`Transcoder`] for implementations whose
16/// input is the encoded unit stream and whose output is the logical value
17/// stream. The trait adds no methods; it exists to make generic bounds
18/// distinguish decoding direction from encoding and unit-to-unit conversion.
19///
20/// The word "buffered" describes the caller-managed buffer and progress model.
21/// It does not require the implementor to own an internal buffer.
22///
23/// # Examples
24///
25/// ```
26/// use qubit_codec::TranscodeDecoder;
27///
28/// fn accepts_decoder<D: TranscodeDecoder>(decoder: &D) {
29/// let _ = decoder;
30/// }
31/// ```
32pub trait TranscodeDecoder: Transcoder<Error = TranscodeDecodeError<Self::DecodeError>> {
33 /// Domain error type produced by decode internals.
34 type DecodeError;
35}