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)
}