pub struct HuffmanDecoder;Expand description
Huffman 解码器:将 Huffman 压缩字节还原为原始字节
使用预计算码长分组查找表 + 二分查找实现高效解码。 对于每个符号,按码长从短到长(5-30)尝试匹配,每组内二分查找 O(log N)。
§安全保证
- 严格拒绝 EOS (symbol 256)
- 填充位验证:≤7 位且全为 1(RFC 7541 §5.2)
- 解压炸弹防护:最大输出 1 MiB(1_048_576 字节)
Implementations§
Source§impl HuffmanDecoder
impl HuffmanDecoder
Sourcepub fn decode_into(
input: &[u8],
output: &mut Vec<u8>,
) -> Result<(), HuffmanDecodeError>
pub fn decode_into( input: &[u8], output: &mut Vec<u8>, ) -> Result<(), HuffmanDecodeError>
解码 Huffman 压缩字节并写入调用方提供的缓冲(热路径复用缓冲,零额外堆分配)
与 HuffmanDecoder::decode 语义完全一致,但不新分配 Vec,
供 HPACK/QPACK 解码热路径以复用缓冲的方式调用。
Trait Implementations§
Source§impl Clone for HuffmanDecoder
impl Clone for HuffmanDecoder
Source§fn clone(&self) -> HuffmanDecoder
fn clone(&self) -> HuffmanDecoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HuffmanDecoder
impl RefUnwindSafe for HuffmanDecoder
impl Send for HuffmanDecoder
impl Sync for HuffmanDecoder
impl Unpin for HuffmanDecoder
impl UnsafeUnpin for HuffmanDecoder
impl UnwindSafe for HuffmanDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more