moq_lite/ietf/
version.rs

1use crate::coding;
2
3pub const ALPN: &str = "moq-00";
4
5#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
6#[repr(u64)]
7pub enum Version {
8	Draft14 = 0xff00000e,
9}
10
11impl TryFrom<coding::Version> for Version {
12	type Error = ();
13
14	fn try_from(value: coding::Version) -> Result<Self, Self::Error> {
15		if value == Self::Draft14.into() {
16			Ok(Self::Draft14)
17		} else {
18			Err(())
19		}
20	}
21}
22
23impl From<Version> for coding::Version {
24	fn from(value: Version) -> Self {
25		Self(value as u64)
26	}
27}
28
29impl Version {
30	pub const fn coding(self) -> coding::Version {
31		coding::Version(self as u64)
32	}
33}