moq_transfork/message/
setup.rsuse super::{Extensions, Version, Versions};
use crate::coding::*;
#[derive(Debug, Clone)]
pub struct ClientSetup {
pub versions: Versions,
pub extensions: Extensions,
}
impl Decode for ClientSetup {
fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
let versions = Versions::decode(r)?;
let extensions = Extensions::decode(r)?;
Ok(Self { versions, extensions })
}
}
impl Encode for ClientSetup {
fn encode<W: bytes::BufMut>(&self, w: &mut W) {
self.versions.encode(w);
self.extensions.encode(w);
}
}
#[derive(Debug, Clone)]
pub struct ServerSetup {
pub version: Version,
pub extensions: Extensions,
}
impl Decode for ServerSetup {
fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
let version = Version::decode(r)?;
let extensions = Extensions::decode(r)?;
Ok(Self { version, extensions })
}
}
impl Encode for ServerSetup {
fn encode<W: bytes::BufMut>(&self, w: &mut W) {
self.version.encode(w);
self.extensions.encode(w);
}
}