use std::ops::{Index, IndexMut};
pub mod cid;
pub mod error;
pub mod flow;
pub mod frame;
pub mod handshake;
pub mod packet;
pub mod param;
pub mod sid;
pub mod token;
pub mod util;
pub mod varint;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub enum Epoch {
Initial = 0,
Handshake = 1,
Data = 2,
}
impl Epoch {
pub const EPOCHS: [Epoch; 3] = [Epoch::Initial, Epoch::Handshake, Epoch::Data];
pub fn iter() -> std::slice::Iter<'static, Epoch> {
Self::EPOCHS.iter()
}
pub const fn count() -> usize {
Self::EPOCHS.len()
}
}
impl<T> Index<Epoch> for [T]
where
T: Sized,
{
type Output = T;
fn index(&self, index: Epoch) -> &Self::Output {
self.index(index as usize)
}
}
impl<T> IndexMut<Epoch> for [T]
where
T: Sized,
{
fn index_mut(&mut self, index: Epoch) -> &mut Self::Output {
self.index_mut(index as usize)
}
}
#[cfg(test)]
mod tests {}