moq_transport/message/
go_away.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::coding::{Decode, DecodeError, Encode, EncodeError};

/// Sent by the server to indicate that the client should connect to a different server.
#[derive(Clone, Debug)]
pub struct GoAway {
	pub url: String,
}

impl Decode for GoAway {
	fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
		let url = String::decode(r)?;
		Ok(Self { url })
	}
}

impl Encode for GoAway {
	fn encode<W: bytes::BufMut>(&self, w: &mut W) -> Result<(), EncodeError> {
		self.url.encode(w)
	}
}