qubit-codec 0.17.4

Core codec traits and buffer conversion primitives for Rust
Documentation
// =============================================================================
//    Copyright (c) 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Incomplete-decode actions returned by buffered decoder policy hooks.

/// Action selected after end-of-input leaves a codec value incomplete.
///
/// The decode engine invokes this action only after the caller has established
/// EOF. A non-rejecting action consumes every source unit still available from
/// the current decode cursor.
///
/// # Type Parameters
///
/// - `Value`: Decoded output value type.
///
/// # Examples
///
/// ```
/// use qubit_codec::engine::DecodeIncompleteAction;
///
/// let action = DecodeIncompleteAction::<u8>::Emit { value: b'?' };
/// assert!(matches!(action, DecodeIncompleteAction::Emit { value: b'?' }));
/// ```
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
#[must_use]
pub enum DecodeIncompleteAction<Value> {
    /// Reject the incomplete source tail.
    ///
    /// The decode engine reports the codec-domain error when available, or an
    /// [`crate::TranscodeFailure::IncompleteInput`] framework error otherwise.
    Reject,

    /// Consume the entire incomplete source tail without output.
    Skip,

    /// Consume the entire incomplete source tail and emit one replacement.
    Emit {
        /// Replacement value to write to the output buffer.
        value: Value,
    },
}