Skip to main content

qubit_codec_binary/codec/
leb128_decode_policy.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
9use super::sealed::Sealed;
10
11/// Describes a type-level LEB128 decoding policy.
12///
13/// This trait is sealed because the current LEB128 decoder only supports the
14/// two built-in canonicality modes represented by [`crate::Strict`] and
15/// [`crate::NonStrict`].
16pub trait Leb128DecodePolicy: Sealed + Copy + Default {
17    /// Whether this policy rejects non-canonical encodings.
18    const STRICT: bool;
19}