sark-http 0.40.0

HTTP wire types, semantics, codecs, and ownership invariants for Sark
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::payload::compress::dynamic;
use dynamic::{Field, mode, table};

use crate::field::metadata::hpack::{decode, statics};

pub(in crate::field::metadata::hpack::decode) fn get<'a>(
    dynamic: &'a table::Table<mode::Staged>,
    index: usize,
) -> Result<Field<'a>, decode::Error> {
    if index < statics::FIRST_DYNAMIC {
        return statics::TABLE.get(index).ok_or(decode::Error::BadIndex);
    }
    dynamic
        .field(index - statics::FIRST_DYNAMIC)
        .ok_or(decode::Error::BadIndex)
}